Here you can find the source of readLines(InputStream is)
public static List<String> readLines(InputStream is) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.IOException; 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 is) throws IOException { return readLines(is, true, new String[] { "#", "//" }); }/*from w ww .j ava 2s. c om*/ /** * Reads all lines from an InputStream ignoring lines that start with commenChar if ignoreComments is true */ public static List<String> readLines(InputStream is, boolean ignoreComments, String... commentChars) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(is)); String line = null; List<String> result = new ArrayList<String>(); while ((line = reader.readLine()) != null) { //ignore empty lines if (line.trim().equals("")) { continue; } //test comments boolean ignoreLine = false; if (ignoreComments) { for (String commentChar : commentChars) { if (line.startsWith(commentChar)) { ignoreLine = true; break; } } } if (!ignoreLine) { result.add(line); } } return result; } }