Here you can find the source of readFile(File file)
public static List<String> readFile(File file) throws Exception
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; public class Main { public static List<String> readFile(File file) throws Exception { List<String> lines = new ArrayList<String>(); BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file))); String line;/*from w w w. j a va 2 s .c o m*/ while ((line = reader.readLine()) != null) { lines.add(line); } reader.close(); return lines; } }