Here you can find the source of getFileString(String filePath)
public static String getFileString(String filePath) 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 getFileString(String filePath) throws IOException { @SuppressWarnings("resource") BufferedReader br = new BufferedReader(new FileReader(filePath)); StringBuilder sb = new StringBuilder(); String r = null;/*from w w w . j ava2 s . c om*/ while ((r = br.readLine()) != null) { sb.append(r); } return sb.toString(); } }