Here you can find the source of readLinesCommon(InputStream in)
private static List<String> readLinesCommon(InputStream in) throws IOException
//package com.java2s; // New BSD License import java.io.BufferedReader; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; public class Main { private static final String DEFAULT_ENCODING = "UTF8"; private static List<String> readLinesCommon(InputStream in) throws IOException { if (in == null) { throw new IOException("Input stream is null."); }//from ww w . j av a 2 s . c om List<String> list = new ArrayList<String>(); BufferedReader reader = null; //subclass of BufferedReader try { reader = new BufferedReader(new InputStreamReader(in, DEFAULT_ENCODING)); String line; while ((line = reader.readLine()) != null) { list.add(line); } return list; } finally { close(reader); } } private static void close(Closeable c) { if (c != null) { try { c.close(); } catch (IOException ex) { } } } }