private final boolean parseStream( JarInputStream jis, boolean toSave) { JarEntry je = null; boolean rc = true; try { JarOutputStream jos = null; if (toSave) jos = new JarOutputStream( new BufferedOutputStream( new FileOutputStream(handler.cachePath + "/" + jarName + ".jar"))); String k = null; while((je = jis.getNextJarEntry()) != null) { String entryName = je.getName(); if (toSave) jos.putNextEntry((JarEntry)je.clone()); ByteArrayOutputStream baos = new ByteArrayOutputStream(); BufferedInputStream bis = new BufferedInputStream(jis); int i; while((i = bis.read()) != -1) baos.write(i); byte[] buf = baos.toByteArray(); if (entryName.endsWith(".class")) { if (classes == null) classes = new HashMap(100); k = entryName.substring(0, entryName.lastIndexOf('.')).replace('/', '.'); Class jarCl = defineClass(k, buf, 0, buf.length); classes.put(k, jarCl); } else { if (resources == null) resources = new HashMap(); resources.put(entryName, buf); } if (toSave) jos.write(buf, 0, buf.length); jis.closeEntry(); } jis.close(); if (toSave) { jos.closeEntry(); jos.close(); } } catch(Exception e) { rc = false; } return rc; }