Here you can find the source of InputStreamToString(InputStream input_stream)
public static String InputStreamToString(InputStream input_stream) throws Exception
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; public class Main { public static String InputStreamToString(InputStream input_stream) throws Exception { StringBuilder sb = new StringBuilder(); BufferedReader br = new BufferedReader(new InputStreamReader(input_stream, "UTF-8")); String sBuffer = br.readLine(); while (sBuffer != null) { sb.append(sBuffer);//from w w w. ja v a 2 s . c o m sb.append(System.lineSeparator()); sBuffer = br.readLine(); } return sb.toString(); } }