public static StreamIterator create(URL url, Filter filter) throws IOException { String urlString = url.toString(); if (urlString.endsWith("!/")) { urlString = urlString.substring(4); urlString = urlString.substring(0, urlString.length() - 2); url = new URL(urlString); } if (!urlString.endsWith("/")) { return new JarIterator(url.openStream(), filter); } else { DirectoryIteratorFactory factory = registry.get(url.getProtocol()); if (factory == null) throw new IOException("Unable to scan directory of protocol: " + url.getProtocol()); return factory.create(url, filter); } }
public StreamIterator create(URL url, Filter filter) throws IOException { File f = new File(url.getPath()); if (f.isDirectory()) { return new FileIterator(f, filter); } else { return new JarIterator(url.openStream(), filter); } } }
public static StreamIterator create(URL url, Filter filter) throws IOException { String urlString = url.toString(); if (urlString.endsWith("!/")) { urlString = urlString.substring(4); urlString = urlString.substring(0, urlString.length() - 2); url = new URL(urlString); } if (!urlString.endsWith("/")) { return new JarIterator(url.openStream(), filter); } else { DirectoryIteratorFactory factory = registry.get(url.getProtocol()); if (factory == null) throw new IOException("Unable to scan directory of protocol: " + url.getProtocol()); return factory.create(url, filter); } } }
public static StreamIterator create(URL url, Filter filter) throws IOException { String urlString = url.toString(); if (urlString.endsWith("!/")) { urlString = urlString.substring(4); urlString = urlString.substring(0, urlString.length() - 2); url = new URL(urlString); } if (!urlString.endsWith("/")) { return new JarIterator(url.openStream(), filter); } else { DirectoryIteratorFactory factory = registry.get(url.getProtocol()); if (factory == null) throw new IOException("Unable to scan directory of protocol: " + url.getProtocol()); return factory.create(url, filter); } } }
public StreamIterator create(URL url, Filter filter) throws IOException { // See http://weblogs.java.net/blog/2007/04/25/how-convert-javaneturl-javaiofile File f; try { f = new File(url.toURI()); } catch (URISyntaxException e) { f = new File(url.getPath()); } if (f.isDirectory()) { return new FileIterator(f, filter); } else { return new JarIterator(url.openStream(), filter); } } }