@Override
    public int read() throws IOException {
        waitForCurrentByteBuffer();
        if (reachedEndOfStream()) {
            return -1;
        }
        byte b = currentByteBuffer[currentBufferPosition];
        currentBufferPosition++;
        overallBytesConsumed++;
        return b & 0xFF;
    }