public static List < String > appendLines ( List < String > result , InputStream inputStream , String encoding ) throws UnsupportedEncodingException , IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( inputStream , encoding == null ? "UTF-8" : encoding ) ) ; while ( true ) { String line = in . readLine ( ) ; if ( line == null ) break ; result . add ( line ) ; } return result ; }
Utility for loading lines from a UTF8 file .