Here you can find the source of readFile(File file)
public final static String readFile(File file) throws Exception
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileInputStream; public class Main { public final static String readFile(File file) throws Exception { FileInputStream fis = new FileInputStream(file); byte[] buffer = new byte[fis.available()]; while (fis.available() != 0) { fis.read(buffer);//w w w .java 2 s. com } fis.close(); return new String(buffer); } }