Here you can find the source of readLines(InputStream in)
public static List<String> readLines(InputStream in)
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.LinkedList; import java.util.List; public class Main { public static List<String> readLines(InputStream in) { final List<String> result = new LinkedList<String>(); final BufferedReader reader = new BufferedReader( new InputStreamReader(in)); String line;// w w w .j a v a 2 s. c o m try { while ((line = reader.readLine()) != null) { result.add(line); } } catch (final IOException e) { throw new RuntimeException(e); } return result; } public static String readLine(InputStream in) { final BufferedReader reader = new BufferedReader( new InputStreamReader(in)); final StringBuilder out = new StringBuilder(); final String newLine = System.getProperty("line.separator"); String line; try { while ((line = reader.readLine()) != null) { out.append(line); out.append(newLine); } } catch (final IOException e) { throw new RuntimeException(e); } return out.toString(); } }