Here you can find the source of getFileContent(String path)
public static final String getFileContent(String path) throws IOException
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; public class Main { public static final String getFileContent(String path) throws IOException { String filecontent = ""; try {/*w w w .java 2s .com*/ File f = new File(path); if (f.exists()) { FileReader fr = new FileReader(path); BufferedReader br = new BufferedReader(fr); String line = br.readLine(); while (line != null) { filecontent += line + "\n"; line = br.readLine(); } br.close(); fr.close(); } } catch (IOException e) { throw e; } return filecontent; } }