Here you can find the source of readFile(String fileName)
public static String readFile(String fileName) 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(String fileName) throws FileNotFoundException { return new Scanner(new File(fileName)).useDelimiter("\\A").next(); }/*from w w w . j a va 2 s . co m*/ }