JarDirClassPath(String dirName) throws NotFoundException { File[] files = new File(dirName).listFiles(new FilenameFilter() { public boolean accept(File dir, String name) { name = name.toLowerCase(); return name.endsWith(".jar") || name.endsWith(".zip"); } }); if (files != null) { jars = new JarClassPath[files.length]; for (int i = 0; i < files.length; i++) jars[i] = new JarClassPath(files[i].getPath()); } }
public URL find(String classname) { if (jars != null) for (int i = 0; i < jars.length; i++) { URL url = jars[i].find(classname); if (url != null) return url; } return null; // not found }
public InputStream openClassfile(String classname) throws NotFoundException { if (jars != null) for (int i = 0; i < jars.length; i++) { InputStream is = jars[i].openClassfile(classname); if (is != null) return is; } return null; // not found }
public void close() { if (jars != null) for (int i = 0; i < jars.length; i++) jars[i].close(); } }
public void close() { if (jars != null) for (int i = 0; i < jars.length; i++) jars[i].close(); } }
JarDirClassPath(String dirName) throws NotFoundException { File[] files = new File(dirName).listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { name = name.toLowerCase(); return name.endsWith(".jar") || name.endsWith(".zip"); } }); if (files != null) { jars = new JarClassPath[files.length]; for (int i = 0; i < files.length; i++) jars[i] = new JarClassPath(files[i].getPath()); } }
@Override public URL find(String classname) { if (jars != null) for (int i = 0; i < jars.length; i++) { URL url = jars[i].find(classname); if (url != null) return url; } return null; // not found } }
@Override public InputStream openClassfile(String classname) throws NotFoundException { if (jars != null) for (int i = 0; i < jars.length; i++) { InputStream is = jars[i].openClassfile(classname); if (is != null) return is; } return null; // not found }
public void close() { if (jars != null) for (int i = 0; i < jars.length; i++) jars[i].close(); } }
private static ClassPath makePathObject(String pathname) throws NotFoundException { String lower = pathname.toLowerCase(); if (lower.endsWith(".jar") || lower.endsWith(".zip")) return new JarClassPath(pathname); int len = pathname.length(); if (len > 2 && pathname.charAt(len - 1) == '*' && (pathname.charAt(len - 2) == '/' || pathname.charAt(len - 2) == File.separatorChar)) { String dir = pathname.substring(0, len - 2); return new JarDirClassPath(dir); } return new DirClassPath(pathname); }
@Override public InputStream openClassfile(String classname) throws NotFoundException { URL jarURL = find(classname); if (null != jarURL) try { java.net.URLConnection con = jarURL.openConnection(); con.setUseCaches(false); return con.getInputStream(); } catch (IOException e) { throw new NotFoundException("broken jar file?: " + classname); } return null; }
public InputStream openClassfile(String classname) throws NotFoundException { if (jars != null) for (int i = 0; i < jars.length; i++) { InputStream is = jars[i].openClassfile(classname); if (is != null) return is; } return null; // not found }
public void close() { if (jars != null) for (int i = 0; i < jars.length; i++) jars[i].close(); } }
private static ClassPath makePathObject(String pathname) throws NotFoundException { String lower = pathname.toLowerCase(); if (lower.endsWith(".jar") || lower.endsWith(".zip")) return new JarClassPath(pathname); int len = pathname.length(); if (len > 2 && pathname.charAt(len - 1) == '*' && (pathname.charAt(len - 2) == '/' || pathname.charAt(len - 2) == File.separatorChar)) { String dir = pathname.substring(0, len - 2); return new JarDirClassPath(dir); } return new DirClassPath(pathname); }
public URL find(String classname) { if (jars != null) for (int i = 0; i < jars.length; i++) { URL url = jars[i].find(classname); if (url != null) return url; } return null; // not found }
public InputStream openClassfile(String classname) throws NotFoundException { if (jars != null) for (int i = 0; i < jars.length; i++) { InputStream is = jars[i].openClassfile(classname); if (is != null) return is; } return null; // not found }
public void close() { if (jars != null) for (int i = 0; i < jars.length; i++) jars[i].close(); } }
JarDirClassPath(String dirName) throws NotFoundException { File[] files = new File(dirName).listFiles(new FilenameFilter() { public boolean accept(File dir, String name) { name = name.toLowerCase(); return name.endsWith(".jar") || name.endsWith(".zip"); } }); if (files != null) { jars = new JarClassPath[files.length]; for (int i = 0; i < files.length; i++) jars[i] = new JarClassPath(files[i].getPath()); } }
public URL find(String classname) { if (jars != null) for (int i = 0; i < jars.length; i++) { URL url = jars[i].find(classname); if (url != null) return url; } return null; // not found }
public InputStream openClassfile(String classname) throws NotFoundException { if (jars != null) for (int i = 0; i < jars.length; i++) { InputStream is = jars[i].openClassfile(classname); if (is != null) return is; } return null; // not found }