List of usage examples for java.util.zip ZipFile toString
public String toString()
From source file:org.opt4j.config.ModuleAutoFinder.java
/** * Retrieves all Classes from a {@link ZipFile} (Jar archive). * //w w w .j a v a 2 s . c o m * @param zipFile * the Jar archive * @return the list of all classes */ protected List<Class<?>> getAllClasses(ZipFile zipFile) { invokeOut(zipFile.toString()); List<Class<?>> classes = new ArrayList<Class<?>>(); List<? extends ZipEntry> entries = Collections.list(zipFile.entries()); for (int i = 0; i < entries.size(); i++) { ZipEntry entry = entries.get(i); String s = entry.getName(); if (s.endsWith(".class")) { s = s.replace("/", "."); s = s.substring(0, s.length() - 6); try { Class<?> clazz = classLoader.loadClass(s); classes.add(clazz); invokeOut("Check: " + clazz.getName()); } catch (ClassNotFoundException e) { } catch (NoClassDefFoundError e) { } catch (UnsupportedClassVersionError e) { System.err.println(s + " not supported: bad version number"); invokeErr(s + " not supported"); } } } return classes; }