Here you can find the source of readLines(String filename)
public static LinkedList<String> readLines(String filename) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.io.FileInputStream; import java.io.InputStreamReader; import java.io.FileInputStream; import java.io.BufferedReader; import java.util.LinkedList; public class Main { public static String ENCODING = "UTF-8"; public static LinkedList<String> readLines(String filename) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename), ENCODING)); LinkedList<String> lines = new LinkedList<String>(); while (true) { String line = reader.readLine(); if (line == null) break; if (line.length() == 0) continue; lines.addLast(line);/* w ww . j av a 2s. c o m*/ } reader.close(); return lines; } }