Here you can find the source of InputStream2String(InputStream in_st, String charset)
public static String InputStream2String(InputStream in_st, String charset) throws IOException
//package com.java2s; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { public static String InputStream2String(InputStream in_st, String charset) throws IOException { BufferedReader buff = new BufferedReader(new InputStreamReader(in_st, charset)); StringBuffer res = new StringBuffer(); String line = ""; while ((line = buff.readLine()) != null) { res.append(line);/* w w w . ja v a2s . co m*/ } return res.toString(); } }