private static byte[] readStream(InputStream in) throws IOException {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        int c;
        while ((c = in.read()) != -1) {
            bos.write(c);
        }
        return bos.toByteArray();
    }
Helper method for reading the content of an input stream.

@param in the stream to be read
@return an array with the content of the stream
@throws IOException if an error occurs
tika-core/src/test/java/org/apache/tika/io/TailStreamTest.java