public static List < ZipEntry > getANNISEntry ( ZipFile file , String table , String ... fileEndings ) { List < ZipEntry > allMatchingEntries = new ArrayList <> ( ) ; if ( fileEndings == null || fileEndings . length == 0 ) { fileEndings = new String [ ] { "tab" , "annis" } ; } final List < String > fullNames = new LinkedList <> ( ) ; for ( String e : fileEndings ) { fullNames . add ( table + "." + e ) ; } Enumeration < ? extends ZipEntry > entries = file . entries ( ) ; while ( entries . hasMoreElements ( ) ) { ZipEntry entry = entries . nextElement ( ) ; if ( ! entry . isDirectory ( ) ) { String name = entry . getName ( ) ; if ( name != null ) { name = name . replaceAll ( "\\\\" , "/" ) ; for ( String n : fullNames ) { if ( n . equalsIgnoreCase ( name ) || entry . getName ( ) . endsWith ( "/" + n ) ) { allMatchingEntries . add ( entry ) ; } } } } } return allMatchingEntries ; }
Find the directories containing the real ANNIS tab files for a zip file .