Here you can find the source of readFile(String filename)
public static String readFile(String filename) throws FileNotFoundException
//package com.java2s; //License from project: LGPL import java.io.*; public class Main { public static String readFile(String filename) throws FileNotFoundException { FileInputStream in = new FileInputStream(filename); return readContents(in); }/* w w w . j a v a2s . c om*/ public static String readContents(InputStream input) { StringBuilder sb = new StringBuilder(); int ch; while (true) { try { ch = input.read(); if (ch != -1) sb.append((char) ch); else break; } catch (IOException e) { break; } } return sb.toString(); } }