Here you can find the source of inputStreamToList(InputStream stream)
private static List<String> inputStreamToList(InputStream stream)
//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 { private static List<String> inputStreamToList(InputStream stream) { List<String> list = new ArrayList<>(); try {//from w w w . j ava 2 s. c o m BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); String line; while ((line = reader.readLine()) != null) { list.add(line); } } catch (Exception ex) { throw new RuntimeException("Can't read Input Stream: " + ex.getMessage()); } return list; } }