@Override
    protected void afterRead(int n) throws IOException {
        if (n != -1) {
            position += n;
        } else {
            consecutiveEOFs++;
            if (consecutiveEOFs > MAX_CONSECUTIVE_EOFS) {
                throw new IOException("Read too many -1 (EOFs); there could be an infinite loop." +
                        "If you think your file is not corrupt, please open an issue on Tika's " +
                        "JIRA");
            }
        }
    }
This relies on {@link IOUtils#skip(InputStream, long, byte[])} to ensure
that the alleged bytes skipped were actually skipped.

@param ln the number of bytes to skip
@return the number of bytes skipped
@throws IOException if the number of bytes requested to be skipped does not match the
number of bytes skipped or if there's an IOException during the read.
tika-core/src/main/java/org/apache/tika/io/TikaInputStream.java