Here you can find the source of readFile(File f)
public static String readFile(File f) throws IOException
//package com.java2s; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; public class Main { public static String readFile(File f) throws IOException { StringBuilder result = new StringBuilder(); Reader in = null;/*from www .j a va 2 s. c o m*/ try { in = new InputStreamReader(new FileInputStream(f), "utf-8"); //$NON-NLS-1$ int c = 0; while ((c = in.read()) >= 0) { result.append((char) c); } } finally { if (in != null) { in.close(); } } return result.toString(); } }