Here you can find the source of readAllInString(InputStream in)
public static String readAllInString(InputStream in) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.io.InputStream; public class Main { public static String readAllInString(InputStream in) throws IOException { return new String(readAll(in)); }// w ww .ja v a2 s . co m public static byte[] readAll(InputStream in) throws IOException { byte[] result = new byte[in.available()]; in.read(result); return result; } }