Here you can find the source of readFile(String fileDir)
public static List<String> readFile(String fileDir) throws Exception
//package com.java2s; import java.io.*; import java.util.ArrayList; import java.util.List; public class Main { public static List<String> readFile(String fileDir) throws Exception { File file = new File(fileDir); List<String> fileList = new ArrayList<String>(); if (!file.exists()) { System.err.println("File Not exist!"); }/*from w w w.j a va 2 s .co m*/ FileReader fileReader = new FileReader(file); BufferedReader br = new BufferedReader(fileReader); String strLine = ""; while ((strLine = br.readLine()) != null) { fileList.add(strLine); } return fileList; } }