Here you can find the source of readAllFile(File file)
public static String readAllFile(File file)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileInputStream; public class Main { public static String readAllFile(File file) { try {/* www.ja v a2 s .c o m*/ FileInputStream i = new FileInputStream(file); byte[] r = new byte[(int) file.length()]; i.read(r); return new String(r); } catch (Exception e) { return null; } } }