Here you can find the source of inputStream2String(InputStream inStream)
public static final String inputStream2String(InputStream inStream) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; public class Main { public static final String inputStream2String(InputStream inStream) throws IOException { return new String(inputStream2byte(inStream)); }// w w w .j a v a 2s. c o m public static final byte[] inputStream2byte(InputStream inStream) throws IOException { ByteArrayOutputStream swapStream = new ByteArrayOutputStream(); byte[] buff = new byte[100]; int rc = 0; while ((rc = inStream.read(buff, 0, 100)) > 0) { swapStream.write(buff, 0, rc); } byte[] in2b = swapStream.toByteArray(); return in2b; } }