Here you can find the source of readFile(final String pFile)
public static StringBuilder readFile(final String pFile) throws Exception
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.File; import java.io.FileReader; public class Main { public static StringBuilder readFile(final String pFile) throws Exception { File bsCWT = new File(pFile); @SuppressWarnings("resource") BufferedReader reader = new BufferedReader(new FileReader(bsCWT)); StringBuilder content = new StringBuilder(); String line;//from w ww .j a v a2s.c om while ((line = reader.readLine()) != null) { // add file line by line to StringBuiler content.append(line + "\n"); } return content; } }