public void show(InputStream is) throws IOException { JarArchiveInputStream jais = new JarArchiveInputStream(is); JarArchiveEntry e = jais.getNextJarEntry(); while (e != null) { if ((!e.isDirectory()) && e.getName().endsWith(".jar")) { cache(e.getName(), jais); } e = jais.getNextJarEntry(); } }
private InputStream getResourceAsStream(String name, InputStream is) throws IOException { JarArchiveInputStream jais = new JarArchiveInputStream(is); JarArchiveEntry e = jais.getNextJarEntry(); while (e != null) { if ((!e.isDirectory()) && e.getName().equals(name)) { return jais; } e = jais.getNextJarEntry(); } return null; }
private void cache(String name, InputStream is) throws IOException { JarArchiveInputStream jais = null; try { jais = new JarArchiveInputStream(is); JarArchiveEntry e = jais.getNextJarEntry(); while (e != null) { if (!e.isDirectory()) { classCache.put(e.getName(), name); } e = jais.getNextJarEntry(); } } finally { // IOUtils.closeQuietly(jais); } }