Here you can find the source of readFile(String file)
public static String readFile(String file) throws IOException
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class Main { public static String readFile(String file) throws IOException { BufferedReader reader = new BufferedReader(new FileReader(file)); String line = null;//from w ww .j av a 2 s . c o m StringBuilder stringBuilder = new StringBuilder(); String ls = System.getProperty("line.separator"); while ((line = reader.readLine()) != null) { stringBuilder.append(line); stringBuilder.append(ls); } return stringBuilder.toString(); } }