public ResourceIterator getResourceIterator ( URL url , Filter filter ) { String urlString = url . toString ( ) ; try { if ( urlString . endsWith ( "!/" ) ) { urlString = urlString . substring ( 4 ) ; urlString = urlString . substring ( 0 , urlString . length ( ) - 2 ) ; url = new URL ( urlString ) ; } if ( urlString . endsWith ( ".class" ) ) { File f = new File ( url . getPath ( ) ) ; return new ClassFileIterator ( f ) ; } else if ( ! urlString . endsWith ( "/" ) ) { return new JarFileIterator ( url . openStream ( ) , filter ) ; } else { if ( ! url . getProtocol ( ) . equals ( "file" ) ) { throw new ResourceReadingException ( "Unable to understand protocol: " + url . getProtocol ( ) ) ; } File f = new File ( url . getPath ( ) ) ; if ( f . isDirectory ( ) || url . getProtocol ( ) . toUpperCase ( ) . equals ( AllowedProtocol . VFS . name ( ) ) ) { return new ClassFileIterator ( f , filter ) ; } else { return new JarFileIterator ( url . openStream ( ) , filter ) ; } } } catch ( MalformedURLException e ) { throw new ResourceReadingException ( e ) ; } catch ( IOException e ) { throw new ResourceReadingException ( e ) ; } }
Gets the resource iterator .