public static String read ( final File file ) throws IOException { final StringBuilder sb = new StringBuilder ( ) ; try ( final FileReader fr = new FileReader ( file ) ; final BufferedReader br = new BufferedReader ( fr ) ; ) { String sCurrentLine ; while ( ( sCurrentLine = br . readLine ( ) ) != null ) { sb . append ( sCurrentLine ) ; } } return sb . toString ( ) ; }
Reads a file and returns the result in a String