Here you can find the source of readFile(String file)
public static String readFile(String file)
//package com.java2s; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; public class Main { public static String readFile(String file) { BufferedReader br = null; StringBuilder text = new StringBuilder(); try {/*w w w .j a v a 2 s . c o m*/ br = new BufferedReader(new FileReader(new File(file))); String line; while ((line = br.readLine()) != null) { text.append(line); } } catch (Exception e) { } finally { if (br != null) { try { br.close(); } catch (IOException e) { e.printStackTrace(); } br = null; } } return text.toString(); } }