Here you can find the source of readLines(String targetPath)
public static List<String> readLines(String targetPath) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class Main { public static List<String> readLines(String targetPath) throws IOException { BufferedReader reader = null; try {//from w ww .ja v a 2s . com reader = new BufferedReader(new FileReader(targetPath)); List<String> rs = new ArrayList<String>(); String line = reader.readLine(); while (line != null) { rs.add(line); line = reader.readLine(); } return rs; } finally { if (reader != null) { reader.close(); } } } }