Here you can find the source of readFileAsText(String path)
public static final String readFileAsText(String path) throws Exception
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { public static final String readFileAsText(String path) throws Exception { FileReader reader = new FileReader(path); BufferedReader br = new BufferedReader(reader); try {// w ww .j a va 2s.co m String text = ""; String line = null; while ((line = br.readLine()) != null) { text = text + line + "\n"; } return text; } finally { br.close(); reader.close(); } } }