Here you can find the source of readLine(String filename, String encoding)
public static List<String> readLine(String filename, String encoding)
//package com.java2s; /*=============================================================================== * Copyright (c) 2010-2012 University of Massachusetts. All Rights Reserved. * * Use of the RankLib package is subject to the terms of the software license set * forth in the LICENSE file included with this software, and also available at * http://people.cs.umass.edu/~vdang/ranklib_license.html *=============================================================================== *///from w w w . jav a 2s . c o m import java.io.BufferedReader; import java.io.FileInputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; public class Main { public static List<String> readLine(String filename, String encoding) { List<String> lines = new ArrayList<String>(); try { String content = ""; BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(filename), encoding)); while ((content = in.readLine()) != null) { content = content.trim(); if (content.length() == 0) continue; lines.add(content); } in.close(); } catch (Exception ex) { System.out.println(ex.toString()); } return lines; } }