Here you can find the source of readLineToList(String pathName, String enCoding)
public static List<String> readLineToList(String pathName, String enCoding)
//package com.java2s; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; public class Main { public static List<String> readLineToList(String pathName, String enCoding) { BufferedReader br = null; String line = ""; List<String> lines = new ArrayList<String>(); br = readToBufferedReader(pathName, enCoding); if (null == br) { return null; }//from w w w . j av a 2s . c o m try { while ((line = br.readLine()) != null) { lines.add(line.trim()); } br.close(); } catch (Exception e) { } return lines; } public static BufferedReader readToBufferedReader(String pathName, String enCoding) { try { return new BufferedReader(readToInputStreamReader((pathName), enCoding)); } catch (Exception e) { return null; } } public static InputStreamReader readToInputStreamReader(String patnName, String enCoding) { try { return new InputStreamReader(readToFileInputStream(patnName), enCoding); } catch (Exception e) { return null; } } public static FileInputStream readToFileInputStream(String pathName) { try { return new FileInputStream(pathName); } catch (FileNotFoundException e) { return null; } } }