Here you can find the source of loadInputStream(InputStream inputStream)
public static String loadInputStream(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 loadInputStream(InputStream inputStream) throws IOException { StringBuffer result = new StringBuffer(); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); String line = reader.readLine(); while (line != null) { result.append(line).append('\n'); line = reader.readLine();/*from w w w.j a va 2s. com*/ } inputStream.close(); return result.toString(); } }