Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /* ************************************************************************
 #
 #  DivConq
 #
 #  http://divconq.com/
 #
 #  Copyright:
 #    Copyright 2014 eTimeline, LLC. All rights reserved.
 #
#  License:
#    See the license.txt file in the project's top-level directory for details.
#  Authors:
#    * Andy White
************************************************************************ */
package divconq.mod;
public class JarLibLoader extends LibLoader {
	public JarLibLoader(String name) {
		super(name);
		JarArchiveInputStream stream = null;
        try {
            InputStream theFile = new FileInputStream(this.);
            stream = new JarArchiveInputStream(theFile);            
            
            JarArchiveEntry entry = stream.getNextJarEntry();
            
            while(entry != null) {
            	if (!entry.isDirectory()) {
            		//if (entry.getName().endsWith("Container.class"))
            		//	System.out.println("at cont");
            		
            		int esize = (intentry.getSize();
            		
            		if (esize > 0) {
	            		int eleft = esize;
	            		byte[] buff = new byte[esize];
	            		int offset = 0;
	            		
	            		while (offset < esize) {
			            	int d = stream.read(buffoffseteleft);
			            	offset += d;
			            	eleft -= d;
	            		}
	            		
		            	this..put("/" + entry.getName(), buff);
            		}
            	}
            	
            	entry = stream.getNextJarEntry();
            }
		}
        catch (Exception x) {
        	// TODO logging
        	..println(x);
        }
        finally {
        	try {
	        	if (stream != null)
	        		stream.close();
        	}
        	catch(Exception x) {
        		
        	}
        }		
	}
New to GrepCode? Check out our FAQ X