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