Here you can find the source of toLines(InputStream is)
private static ArrayList<String> toLines(InputStream is)
//package com.java2s; //License from project: Open Source License import java.io.InputStream; import java.util.ArrayList; import java.util.Scanner; public class Main { private static ArrayList<String> toLines(InputStream is) { ArrayList<String> lines = new ArrayList<String>(); Scanner in = new Scanner(is); while (in.hasNextLine()) { String line = in.nextLine().trim(); if (line.length() > 0) lines.add(line);/*from w ww . j a v a 2 s.c om*/ } return lines; } }