Here you can find the source of inputStreamToString(InputStream inputStream)
static String inputStreamToString(InputStream inputStream)
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { private static final int BUFFER_SIZE = 8192; static String inputStreamToString(InputStream inputStream) { StringBuilder sb = new StringBuilder(BUFFER_SIZE); try {/*ww w . ja va2 s . co m*/ BufferedReader r = new BufferedReader(new InputStreamReader(inputStream)); String str = null; while ((str = r.readLine()) != null) { sb.append(str); } } catch (IOException ioe) { throw new RuntimeException(ioe); } return sb.toString(); } }