Here you can find the source of readInputStreamContent(InputStream inputStream)
public static String readInputStreamContent(InputStream inputStream) throws IOException
//package com.java2s; import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.IOException; public class Main { public static String readInputStreamContent(InputStream inputStream) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader( inputStream));/*from w ww . j a v a 2s.c o m*/ StringBuilder content = new StringBuilder(); try { String line = reader.readLine(); String separator = System.getProperty("line.separator"); while (line != null) { content.append(line); content.append(separator); line = reader.readLine(); } } finally { reader.close(); } return content.toString(); } }