Java tutorial
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.IOException; import java.io.Reader; import java.util.ArrayList; import java.util.List; public class Main { public static List<String> readFile(Reader simpleReader) throws IOException { BufferedReader reader = new BufferedReader(simpleReader); try { List<String> res = new ArrayList<String>(); String line; while ((line = reader.readLine()) != null) { res.add(line); } return res; } finally { reader.close(); } } }