@Override
    public synchronized int available() throws IOException {
        int n = count - pos;
        int avail = getInIfOpen().available();
        return n > (Integer.MAX_VALUE - avail)
            ? Integer.MAX_VALUE
            : n + avail;
    }
Returns an estimate of the number of bytes that can be read (or
skipped over) from this input stream without blocking by the next
invocation of a method for this input stream. The next invocation might be
the same thread or another thread.  A single read or skip of this
many bytes will not block, but may read or skip fewer bytes.
<p>
This method returns the sum of the number of bytes remaining to be read in
the buffer (<code>count&nbsp;- pos</code>) and the result of calling the
{@link java.io.FilterInputStream#in in}.available().

@return an estimate of the number of bytes that can be read (or skipped
over) from this input stream without blocking.
@throws IOException if this input stream has been closed by
                    invoking its {@link #close()} method,
                    or an I/O error occurs.
@see BufferedInputStream#available()
clients/src/main/java/org/apache/kafka/common/utils/ChunkedBytesStream.java