Here you can find the source of readFile(String path)
public static List<String> readFile(String path) throws Exception
//package com.java2s; //License from project: Apache License import java.io.*; import java.util.ArrayList; import java.util.List; public class Main { public static List<String> readFile(String path) throws Exception { List<String> lines = new ArrayList<String>(); BufferedReader reader = new BufferedReader(new FileReader(path)); String line = reader.readLine(); while (line != null) { lines.add(line);/*from ww w. j a v a 2s . com*/ line = reader.readLine(); } reader.close(); return lines; } }