Here you can find the source of readFile(File file)
public static String readFile(File file) throws IOException
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { public static String readFile(File file) throws IOException { int nread; byte buf[] = new byte[8192]; String content = ""; FileInputStream fis = new FileInputStream(file); while ((nread = fis.read(buf)) != -1) { content += new String(buf, 0, nread); }/* www .jav a2s . c o m*/ fis.close(); return content; } }