SimpleJarEntryScanner { @Nonnull public Set<JarEntry> scan(URL jarURL, final boolean recursive) throws NullPointerException, IllegalArgumentException, IOException { return scan(jarURL, recursive, null); } protected  SimpleJarEntryScanner(); @Nonnull Set<JarEntry> scan(URL jarURL, final boolean recursive); @Nonnull Set<JarEntry> scan(URL jarURL, final boolean recursive, JarEntryFilter jarEntryFilter); Set<JarEntry> scan(JarFile jarFile, final boolean recursive); Set<JarEntry> scan(JarFile jarFile, final boolean recursive, JarEntryFilter jarEntryFilter); static final SimpleJarEntryScanner INSTANCE; }
@Test public void testScan() throws IOException { URL resourceURL = ClassLoaderUtils.getClassResource(classLoader, String.class); Set<JarEntry> jarEntrySet = simpleJarEntryScanner.scan(resourceURL, true); Assert.assertEquals(1, jarEntrySet.size()); JarFile jarFile = JarUtils.toJarFile(resourceURL); jarEntrySet = simpleJarEntryScanner.scan(jarFile, true); Assert.assertTrue(jarEntrySet.size() > 1000); jarEntrySet = simpleJarEntryScanner.scan(jarFile, true, new JarEntryFilter() { @Override public boolean accept(JarEntry jarEntry) { return jarEntry.getName().equals("java/lang/String.class"); } }); Assert.assertEquals(1, jarEntrySet.size()); }