Here you can find the source of getStreamContent(InputStream is)
public static String getStreamContent(InputStream is) throws IOException
//package com.java2s; //License from project: LGPL import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { public static String getStreamContent(InputStream is) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(is)); String c = "", line; while ((line = reader.readLine()) != null) c += "\n" + line; return c.substring(1); }/*from w w w . ja v a2 s. c om*/ }