Here you can find the source of ReadAllFromStream(InputStream source)
public static String ReadAllFromStream(InputStream source) throws IOException
//package com.java2s; //License from project: LGPL import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { public static String ReadAllFromStream(InputStream source) throws IOException { StringBuilder sb = new StringBuilder(); BufferedReader br = new BufferedReader(new InputStreamReader(source)); String line;//w ww .j av a 2 s.co m while ((line = br.readLine()) != null) { sb.append(line).append("\n"); } return sb.toString(); } }