Here you can find the source of readFile(File f)
public static String readFile(File f) throws FileNotFoundException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class Main { public static String readFile(File f) throws FileNotFoundException { Scanner sc = new Scanner(f); StringBuilder sb = new StringBuilder(); while (sc.hasNextLine()) sb.append(sc.nextLine());// ww w.jav a 2 s .co m sc.close(); return sb.toString(); } }