Here you can find the source of readTextFile(String fn)
public static String readTextFile(String fn) throws IOException
//package com.java2s; //License from project: LGPL import java.io.FileInputStream; import java.io.IOException; public class Main { public static String readTextFile(String fn) throws IOException { FileInputStream fis = new FileInputStream(fn); int numBytes = fis.available(); byte[] buf = new byte[numBytes]; fis.read(buf);// ww w . j a va 2 s . com String content = new String(buf); return content; } }