Here you can find the source of convertInputStreamToString(InputStream inputStream)
public 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 { public 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 www . j ava 2 s . c o m inputStream.close(); return result; } }