Here you can find the source of getStreamAsString(InputStream stream)
public static String getStreamAsString(InputStream stream) throws IOException
//package com.java2s; /*/*from w w w . ja va 2s .co m*/ * Copyright (c) 2013, Miguel Martins * Use is subject to license terms. * * This source code file is provided under the MIT License. Full licensing * terms should be available in the form of text files. The standard source code * distribution provides a LICENSE.txt file which can be consulted for licensing * details. */ import java.io.IOException; import java.io.InputStream; public class Main { public static String getStreamAsString(InputStream stream) throws IOException { String output = ""; byte[] buffer = new byte[4096]; while (stream.read(buffer) > 0) { output = output + new String(buffer); } return output; } }