class IOUtils {

    public static byte[] readInputStream(InputStream inputStream) throws IOException {
        byte[] buf = new byte[BUFFER_SIZE];
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        int n;
        while ((n = inputStream.read(buf)) >= 0) {
            out.write(buf, 0, n);
        }
        return out.toByteArray();
    }

}