Here you can find the source of inputStreamToStr(InputStream is)
public static String inputStreamToStr(InputStream is) throws IOException
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { public static String inputStreamToStr(InputStream is) throws IOException { BufferedReader bin = null; StringBuilder sin = new StringBuilder(); String line;/* ww w . j av a 2 s .c o m*/ try { bin = new BufferedReader(new InputStreamReader(is)); while ((line = bin.readLine()) != null) { sin.append(line + "\n"); } } finally { if (bin != null) bin.close(); } return sin.toString(); } }