@Override
    public int peek() throws IOException {
        ensureOpen();

        if (buffer == ClickHouseByteBuffer.EMPTY_BUFFER) {
            return -1;
        }

        int b = 0xFF & buffer.get();
        ((Buffer) buffer).position(buffer.position() - 1);
        return b;
    }
Update inner buffer as needed.

@return remaining bytes in buffer
@throws IOException when failed to update buffer
clickhouse-data/src/main/java/com/clickhouse/data/stream/AbstractByteBufferInputStream.java