@Override
  public int read() throws IOException {
    Preconditions.checkState(mBufferOffset <= mBufferedSize);
    ensureNotClosed();
    if (!ensureDataInBuffer()) {
      return -1;
    }

    return mByteArray[mBufferOffset++] & 0xFF;
  }
position of next buffered byte in mByteArray to be read

<p>invariant: 0 <= mBufferOffset <= mBufferedSize
fbcore/src/main/java/com/facebook/common/memory/PooledByteArrayBufferedInputStream.java