Here you can find the source of convertStreamToString(InputStream is)
public static String convertStreamToString(InputStream is)
//package com.java2s; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; public class Main { public static String convertStreamToString(InputStream is) { BufferedReader reader = null; try {// w ww . j a v a 2 s .c om reader = new BufferedReader(new InputStreamReader(is, "utf-8"),// "UTF-8" 512 * 1024); } catch (Exception e) { } StringBuilder sb = new StringBuilder(); String line = null; try { while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } } catch (Exception e) { } finally { try { is.close(); } catch (Exception e) { } } return sb.toString(); } }