Here you can find the source of readFile(String fullPath)
public static String readFile(String fullPath) throws IOException
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; public class Main { public static String readFile(String fullPath) throws IOException { return readFile(new File(fullPath)); }/*from w w w . jav a 2 s .co m*/ public static String readFile(File file) throws IOException { BufferedReader reader = null; FileReader fr = null; StringBuilder builder = new StringBuilder(""); try { fr = new FileReader(file); reader = new BufferedReader(fr); if (reader == null) return null; String line = null; while ((line = reader.readLine()) != null) { builder.append(line + "\n"); } } finally { if (fr != null) fr.close(); if (reader != null) reader.close(); } return builder.toString(); } }