Here you can find the source of readFile(String filename)
public static List<String> readFile(String filename) throws IOException
//package com.java2s; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class Main { public static List<String> readFile(String filename) throws IOException { return readFile(new File(filename)); }/*from www . j a va2s. c o m*/ public static List<String> readFile(File file) throws IOException { List<String> lines = new ArrayList<String>(); BufferedReader in = new BufferedReader(new FileReader(file)); String line; while ((line = in.readLine()) != null) lines.add(line); return lines; } }