Here you can find the source of loadText(String path)
public static String loadText(String path)
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class Main { public static String loadText(String path) { String result = ""; try {//w w w .j av a2 s . co m BufferedReader reader = new BufferedReader(new FileReader(path)); String buffer; while ((buffer = reader.readLine()) != null) { result += buffer + "\n"; } } catch (IOException e) { e.printStackTrace(); } return result; } }