public void visit(final String name) { String normalized = name.replace('/', '.'); if (normalized.startsWith("/")) { normalized = normalized.substring(1); } if (normalized.startsWith("META-INF.versions.")) { final String version = normalized.substring("META-INF.versions.".length()); final int nextSep = version.indexOf('.'); if (nextSep < 0) { return; } final String vStr = version.substring(0, nextSep); final int major; try { if ((major = Integer.parseInt(vStr)) > MJAR_VERSION) { return; } } catch (final NumberFormatException nfe) { return; } if (nextSep < version.length()) { final String cname = version.substring(nextSep + 1); final Clazz existing = classes.get(cname); if (existing == null || existing.version < major) { classes.put(cname, new Clazz(name + (!version.endsWith(".class") ? ".class" : ""), major)); } } } }
public void visit(final String name) { String normalized = name.replace('/', '.'); if (normalized.startsWith("/")) { normalized = normalized.substring(1); } if (normalized.startsWith("META-INF.versions.")) { final String version = normalized.substring("META-INF.versions.".length()); final int nextSep = version.indexOf('.'); if (nextSep < 0) { return; } final String vStr = version.substring(0, nextSep); final int major; try { if ((major = Integer.parseInt(vStr)) > MJAR_VERSION) { return; } } catch (final NumberFormatException nfe) { return; } if (nextSep < version.length()) { final String cname = version.substring(nextSep + 1); final Clazz existing = classes.get(cname); if (existing == null || existing.version < major) { classes.put(cname, new Clazz(name + (!version.endsWith(".class") ? ".class" : ""), major)); } } } }
public InputStream getBytecode(String className) throws IOException, ClassNotFoundException { int pos = className.indexOf("<"); if (pos > -1) { className = className.substring(0, pos); } pos = className.indexOf(">"); if (pos > -1) { className = className.substring(0, pos); } if (!className.endsWith(".class")) { className = className.replace('.', '/') + ".class"; } if (mjar.isMjar()) { final MJarSupport.Clazz resource = mjar.getClasses().get(className); if (resource != null) { className = resource.getPath() + ".class"; } } URL resource = loader.getResource(className); if (resource != null) return new BufferedInputStream(resource.openStream()); throw new ClassNotFoundException(className); }
public InputStream getBytecode(String className) throws IOException, ClassNotFoundException { int pos = className.indexOf("<"); if (pos > -1) { className = className.substring(0, pos); } pos = className.indexOf(">"); if (pos > -1) { className = className.substring(0, pos); } if (!className.endsWith(".class")) { className = className.replace('.', '/') + ".class"; } if (mjar.isMjar()) { final MJarSupport.Clazz resource = mjar.getClasses().get(className); if (resource != null) { className = resource.getPath() + ".class"; } } URL resource = loader.getResource(className); if (resource != null) return new BufferedInputStream(resource.openStream()); throw new ClassNotFoundException(className); }