public static String readText(File file) throws IOException {
  String thisLine;
  StringBuffer strb=new StringBuffer("");
  FileInputStream fin=new FileInputStream(file);
  BufferedReader br=new BufferedReader(new InputStreamReader(fin));
  while ((thisLine=br.readLine()) != null) {
    strb.append(thisLine + "\r\n");
  }
  String result=strb.toString();
  return result;
}

public static String readText ( File file ) throws IOException { String thisLine ; StringBuffer strb = new StringBuffer ( "" ) ; FileInputStream fin = new FileInputStream ( file ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( fin ) ) ; while ( ( thisLine = br . readLine ( ) ) != null ) { strb . append ( thisLine + "\r\n" ) ; } String result = strb . toString ( ) ; return result ; }
gets the contents of a text file as a single string
