Here you can find the source of inputStreamToStr(InputStream is)
public static String inputStreamToStr(InputStream is)
//package com.java2s; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; public class Main { public static String inputStreamToStr(InputStream is) { try {//from ww w. j a va 2 s .com BufferedReader reader = new BufferedReader(new InputStreamReader(is)); StringBuffer strBuf = new StringBuffer(); String str = reader.readLine(); while (str != null) { strBuf.append(str); str = reader.readLine(); } return strBuf.toString().trim(); } catch (Exception ex) { throw new RuntimeException(ex); } } }