public static String readFile ( String name ) throws IOException { StringBuilder b = new StringBuilder ( ) ; BufferedReader r = new BufferedReader ( new FileReader ( name ) ) ; String line ; while ( ( line = r . readLine ( ) ) != null ) { b . append ( line ) . append ( ' ' ) ; } r . close ( ) ; return b . toString ( ) ; }
Read a file and provide its content as String .