private static String fileAsString ( String path ) throws Exception { StringBuffer buffer = new StringBuffer ( ) ; InputStream fis = new FileInputStream ( path ) ; InputStreamReader isr = new InputStreamReader ( fis , "UTF-8" ) ; Reader in = new BufferedReader ( isr ) ; int ch ; while ( ( ch = in . read ( ) ) > - 1 ) { buffer . append ( ( char ) ch ) ; } in . close ( ) ; return buffer . toString ( ) ; }
Converts file into string .