Here you can find the source of slurp(InputStream in)
public static String slurp(InputStream in)
//package com.java2s; import java.io.IOException; import java.io.InputStream; public class Main { public static String slurp(InputStream in) { StringBuffer out = new StringBuffer(); byte[] b = new byte[4096]; try {//w ww . j av a 2 s. co m for (int n; (n = in.read(b)) != -1;) { out.append(new String(b, 0, n)); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return out.toString(); } }