Here you can find the source of inputStreamContent(InputStream is)
public static String inputStreamContent(InputStream is) throws IOException
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { public static String inputStreamContent(InputStream is) throws IOException { StringBuilder content = new StringBuilder(""); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(is)); char[] buffer = new char[4096]; int charsRead; try {//from w w w.j a v a 2 s. c om while ((charsRead = bufferedReader.read(buffer)) > 0) { content.append(buffer, 0, charsRead); } } catch (IOException e) { e.printStackTrace(); throw e; } finally { bufferedReader.close(); } return content.toString(); } }