@Override
    public int read(byte[] buf, int ofs, int length) throws IOException {
        int read = super.read(buf, ofs, length);
        if (read > 0) {
            appendBuf(buf, ofs, read);
        }
        return read;
    }
{@inheritDoc} This implementation delegates to the underlying stream and
then adds the correct portion of the read buffer to the internal tail
buffer.
tika-core/src/main/java/org/apache/tika/io/TailStream.java