public static List < String > readResourceAsLines ( Class < ? > classObj , String resourceName ) throws IOException { InputStream in = getResourceAsStream ( resourceName , classObj ) ; try ( BufferedReader buffer = new BufferedReader ( new InputStreamReader ( in ) ) ) { List < String > lines = new ArrayList <> ( ) ; String line ; while ( ( line = buffer . readLine ( ) ) != null ) { lines . add ( line ) ; } return lines ; } }
Reads everything from a textual resource as lines using the default character set .