Here you can find the source of readFile(File file)
public static String readFile(File file) throws FileNotFoundException
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class Main { private static final String MULTILINE_START_ANCHOR_REGEX = "\\A"; public static String readFile(String filename) throws FileNotFoundException { return readFile(new File(filename)); }//w ww. ja v a2 s. c om public static String readFile(File file) throws FileNotFoundException { Scanner scanner = new Scanner(file); String ret = scanner.useDelimiter(MULTILINE_START_ANCHOR_REGEX).next(); scanner.close(); return ret; } }