FileDocCategorySizeDatePackage
AEJarReader.javaAPI DocAzureus 3.0.3.42179Mon Oct 04 14:04:30 BST 2004org.gudy.azureus2.core3.util.jar

AEJarReader

public class AEJarReader extends Object
author
parg

Fields Summary
protected Map
entries
Constructors Summary
public AEJarReader(String name)

	
	
	
				 
	
		InputStream 	is 	= null;
		JarInputStream 	jis = null;
		
		try{
			is = getClass().getClassLoader().getResourceAsStream(name);
			
			jis = new JarInputStream(is );
			
			while( true ){
				
				JarEntry ent = jis.getNextJarEntry();
				
				if ( ent == null ){
					
					break;
				}
				
				if ( ent.isDirectory()){
					
					continue;
				}
				
				ByteArrayOutputStream	baos = new ByteArrayOutputStream();
					
				byte[]	buffer = new byte[8192];
					
				while( true ){
						
					int	l = jis.read( buffer );
						
					if ( l <= 0 ){
							
						break;
					}
						
					baos.write( buffer, 0, l );
				}
					
				entries.put( ent.getName(), new ByteArrayInputStream( baos.toByteArray()));
			}
		
		}catch( Throwable e ){
			
			Debug.printStackTrace( e );
						
		}finally{
			
			try{
				if ( jis != null ){
					
					jis.close();
				}
				
				if (is != null){
					
					is.close();
				}
			}catch( Throwable e ){
				
			}
		}
	
Methods Summary
public java.io.InputStreamgetResource(java.lang.String name)

		return((InputStream)entries.get(name));