Here you can find the source of readAll(InputStream in)
public static byte[] readAll(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 byte[] readAll(InputStream in) throws IOException { byte[] result = new byte[in.available()]; in.read(result);//from www . ja v a 2 s. co m return result; } }