Here you can find the source of getFileContent(String path)
public static String getFileContent(String path) throws IOException
//package com.java2s; // Released under the terms of the GNU General Public License version 2 or later. import java.io.*; public class Main { public static String getFileContent(String path) throws IOException { File input = new File(path); return getFileContent(input); }//from w w w.j a v a 2s . c o m public static String getFileContent(File input) throws IOException { char chars[] = new char[(int) (input.length())]; FileReader in = new FileReader(input); in.read(chars); in.close(); return new String(chars); } }