ClassPathIterator(URL url) throws IOException { String protocol = url != null ? url.getProtocol() : null; if( protocol == null ) { } else if( protocol.equals("file") ) { File tmp = new File(url.getFile()); if( tmp.isDirectory() ) { rootLength = tmp.getPath().length() + 1; fileIter = new FileIterator(tmp); } else { // Assume this is a jar archive InputStream is = new FileInputStream(tmp); zis = new ZipInputStream(is); } } else { // Assume this points to a jar InputStream is = url.openStream(); zis = new ZipInputStream(is); } }
ClassPathIterator(URL url) throws IOException { String protocol = url != null ? url.getProtocol() : null; if( protocol == null ) { } else if( protocol.equals("file") ) { File tmp = new File(url.getFile()); if( tmp.isDirectory() ) { rootLength = tmp.getPath().length() + 1; fileIter = new FileIterator(tmp); } else { // Assume this is a jar archive InputStream is = new FileInputStream(tmp); zis = new ZipInputStream(is); } } else { // Assume this points to a jar InputStream is = url.openStream(); zis = new ZipInputStream(is); } }
ClassPathEntry getNextEntry() throws IOException { ClassPathEntry entry = null; if( zis != null ) { ZipEntry zentry = zis.getNextEntry(); if( zentry != null ) entry = new ClassPathEntry(zentry); } else if( fileIter != null ) { File fentry = fileIter.getNextEntry(); if( fentry != null ) entry = new ClassPathEntry(fentry, rootLength); file = fentry; } return entry; }
ClassPathEntry getNextEntry() throws IOException { ClassPathEntry entry = null; if( zis != null ) { ZipEntry zentry = zis.getNextEntry(); if( zentry != null ) entry = new ClassPathEntry(zentry); } else if( fileIter != null ) { File fentry = fileIter.getNextEntry(); if( fentry != null ) entry = new ClassPathEntry(fentry, rootLength); file = fentry; } return entry; }