Here you can find the source of readFile(final File file)
protected static String readFile(final File file) throws IOException
//package com.java2s; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; public class Main { protected static String readFile(final File file) throws IOException { final StringBuilder builder = new StringBuilder(); final BufferedReader reader = new BufferedReader(new FileReader(file)); for (;;) { final String line = reader.readLine(); if (line == null) break; builder.append(line).append('\n'); }/* w w w. jav a2 s. com*/ reader.close(); return builder.toString(); } }