Here you can find the source of readLines(InputStream stream)
public static List<String> readLines(InputStream stream) throws Exception
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; public class Main { public static List<String> readLines(InputStream stream, String charsetname) throws Exception { List<String> lines = new ArrayList<String>(); BufferedReader reader = null; try {/*from w w w . jav a 2s. c om*/ reader = new BufferedReader(new InputStreamReader(stream, charsetname)); String line = null; while ((line = reader.readLine()) != null) { lines.add(line); } return lines; } finally { if (reader != null) reader.close(); } } public static List<String> readLines(InputStream stream) throws Exception { List<String> lines = new ArrayList<String>(); BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(stream)); String line = null; while ((line = reader.readLine()) != null) { lines.add(line); } return lines; } finally { if (reader != null) reader.close(); } } }