Here you can find the source of readFile(String path)
public static ArrayList<String> readFile(String path) throws Exception
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.FileInputStream; import java.io.InputStreamReader; import java.util.*; public class Main { public static ArrayList<String> readFile(String path) throws Exception { ArrayList<String> result = new ArrayList<String>(); InputStreamReader isReader = new InputStreamReader(new FileInputStream(path), "UTF-8"); BufferedReader reader = new BufferedReader(isReader); String aline;/*from w ww . j ava 2 s. c o m*/ while ((aline = reader.readLine()) != null) { result.add(aline); } reader.close(); return result; } }