public static List < String > readFileToList ( final File file , final String encoding ) throws IOException { final List < String > fn = new ArrayList <> ( ) ; try ( BufferedReader reader = ( BufferedReader ) StreamExtensions . getReader ( file , encoding , false ) ) { // the line. String line = null ; // read all lines from the file do { line = reader . readLine ( ) ; // if null break the loop if ( line == null ) { break ; } fn . add ( line ) ; } while ( true ) ; } catch ( final IOException e ) { throw e ; } return fn ; }
Reads every line from the given File into a List and returns the List .