private void handle(File file, String packageName) throws ClassNotFoundException { for (File child : file.listFiles()) { if (!child.isDirectory() && child.getName().endsWith(SUFFIX_CLASS)) { final String packagePrefix = packageName.length() > 0 ? packageName + "." : packageName; String className = packagePrefix + child.getName().substring(0, child.getName().lastIndexOf(SUFFIX_CLASS)); foundClass(className, prefix + className.replace( '.', '/' ) + SUFFIX_CLASS ); } else if (child.isDirectory() && addRecursively) { handle(child, packageName + "." + child.getName()); } } }
private void handle(File file, String packageName) throws ClassNotFoundException { for (File child : file.listFiles()) { if (!child.isDirectory() && child.getName().endsWith(SUFFIX_CLASS)) { final String packagePrefix = packageName.length() > 0 ? packageName + "." : packageName; String className = packagePrefix + child.getName().substring(0, child.getName().lastIndexOf(SUFFIX_CLASS)); foundClass(className, prefix + className.replace( '.', '/' ) + SUFFIX_CLASS ); } else if (child.isDirectory() && addRecursively) { handle(child, packageName + "." + child.getName()); } } }
private void handleArchiveByFile(File file) throws IOException, ClassNotFoundException { try { log.fine("archive: " + file); ZipFile zip = new ZipFile(file); Enumeration<? extends ZipEntry> entries = zip.entries(); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); String name = entry.getName(); if (name.startsWith(prefix + packageNamePath) && name.endsWith(SUFFIX_CLASS) && (addRecursively || !name.substring((prefix + packageNamePath).length() + 1).contains("/"))) { String className = name.replace("/", ".").substring(prefix.length(), name.length() - SUFFIX_CLASS.length()); foundClass(className, name ); } } } catch (ZipException e) { throw new RuntimeException("Error handling file " + file, e); } }
private void handleArchiveByFile(File file) throws IOException, ClassNotFoundException { try { log.fine("archive: " + file); ZipFile zip = new ZipFile(file); Enumeration<? extends ZipEntry> entries = zip.entries(); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); String name = entry.getName(); if (name.startsWith(prefix + packageNamePath) && name.endsWith(SUFFIX_CLASS) && (addRecursively || !name.substring((prefix + packageNamePath).length() + 1).contains("/"))) { String className = name.replace("/", ".").substring(prefix.length(), name.length() - SUFFIX_CLASS.length()); foundClass(className, name ); } } } catch (ZipException e) { throw new RuntimeException("Error handling file " + file, e); } }