private static byte[] readAll(final InputStream is) throws IOException {
        final ByteArrayOutputStream tmp = new ByteArrayOutputStream();

        final byte[] buf = new byte[2000];
        int read = is.read(buf);
        while (read > 0) {
            tmp.write(buf, 0, read);
            read = is.read(buf);
        }
        return tmp.toByteArray();
    }
Reads all available bytes from the stream

@param is the InputStream to read
@return the byte[] array output
@throws IOException if any error occurs reading stream
primefaces/src/main/java/org/primefaces/virusscan/impl/ClamDaemonClient.java