public List < String > scan ( ) { try { JarFile jar = new JarFile ( jarURL . getFile ( ) ) ; try { List < String > result = new ArrayList <> ( ) ; Enumeration < JarEntry > en = jar . entries ( ) ; while ( en . hasMoreElements ( ) ) { JarEntry entry = en . nextElement ( ) ; String path = entry . getName ( ) ; boolean match = includes . size ( ) == 0 ; if ( ! match ) { for ( String pattern : includes ) { if ( patternMatches ( pattern , path ) ) { match = true ; break ; } } } if ( match ) { for ( String pattern : excludes ) { if ( patternMatches ( pattern , path ) ) { match = false ; break ; } } } if ( match ) { result . add ( path ) ; } } return result ; } finally { jar . close ( ) ; } } catch ( IOException e ) { throw new IllegalStateException ( e ) ; } }
Scans the jar file and returns the paths that match the includes and excludes .