public List < LanguageProfile > readAll ( File path ) throws IOException { if ( ! path . exists ( ) ) { throw new IOException ( "No such folder: " + path ) ; } if ( ! path . canRead ( ) ) { throw new IOException ( "Folder not readable: " + path ) ; } File [ ] listFiles = path . listFiles ( new FileFilter ( ) { @ Override public boolean accept ( File pathname ) { return looksLikeLanguageProfileFile ( pathname ) ; } } ) ; if ( listFiles == null ) { throw new IOException ( "Failed reading from folder: " + path ) ; } List < LanguageProfile > profiles = new ArrayList <> ( listFiles . length ) ; for ( File file : listFiles ) { if ( ! looksLikeLanguageProfileFile ( file ) ) { continue ; } profiles . add ( read ( file ) ) ; } return profiles ; }
Loads all profiles from the specified directory .