Here you can find the source of getFileContent(File file)
public static String getFileContent(File file) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { public static String getFileContent(File file) throws IOException { Long fileLengthLong = file.length(); byte[] fileContent = new byte[fileLengthLong.intValue()]; FileInputStream inputStream = new FileInputStream(file); inputStream.read(fileContent);/* w w w .j a v a2 s . co m*/ inputStream.close(); String string = new String(fileContent); return string; } }