Here you can find the source of convertStreamToText(InputStream is)
public static StringBuilder convertStreamToText(InputStream is)
//package com.java2s; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { public static StringBuilder convertStreamToText(InputStream is) { String line = ""; StringBuilder total = new StringBuilder(); //wrap a BufferedReader around the input stream... BufferedReader rd = new BufferedReader(new InputStreamReader(is)); //read response until the end... try {// ww w. j av a 2s . c o m while ((line = rd.readLine()) != null) { total.append(line); } } catch (IOException e) { } //return full string return total; } }