@Override
    public int read() throws IOException {
        if (max >= 0 && pos >= max) {
            return EOF;
        }
        final int result = in.read();
        pos++;
        return result;
    }
Very slight modification of Commons' BoundedInputStream
so that we can figure out if this hit the bound or not.
<p>
This relies on IOUtils' skip and read to try to fully
read/skip inputstream.
tika-core/src/main/java/org/apache/tika/io/BoundedInputStream.java