Here you can find the source of getInputStreamAsString(InputStream inStream)
public static String getInputStreamAsString(InputStream inStream) throws IOException
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { public static String getInputStreamAsString(InputStream inStream) throws IOException { // todo: should i wrap inputStream in BufferedInputStream? StringBuffer text = new StringBuffer(); InputStreamReader in = new InputStreamReader(inStream, "Unicode"); char buffer[] = new char[4096]; int bytes_read; while ((bytes_read = in.read(buffer)) != -1) text.append(new String(buffer, 0, bytes_read)); return text.toString(); }//from w w w . j a v a 2s. c om }