Here you can find the source of convertInputStreamToString(InputStream inputStream)
private static String convertInputStreamToString(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 { private static String convertInputStreamToString(InputStream inputStream) throws IOException { BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(inputStream)); String line = ""; String result = ""; while ((line = bufferedReader.readLine()) != null) { result += line;//from w w w . ja v a2 s . c o m } inputStream.close(); return result; } }