Here you can find the source of inputStreamToString(InputStream inputStream)
public static String inputStreamToString(InputStream inputStream) throws IOException
//package com.java2s; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { public static final int BUFFER_SIZE = 8192; public static String inputStreamToString(InputStream inputStream) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader( inputStream), BUFFER_SIZE); StringBuffer buffer = new StringBuffer(); String line = ""; while ((line = in.readLine()) != null) { buffer.append(line);/*from w w w.j a v a 2 s . co m*/ } return buffer.toString(); } }