@Override
    protected ClickHouseByteBuffer nextBuffer() throws IOException {
        if (closed) {
            return byteBuffer.reset();
        }

        if ((buffer != null && buffer.hasRemaining()) || updateBuffer() > 0) {
            byteBuffer.update(buffer);
            ((Buffer) buffer).position(buffer.limit());
        } else {
            byteBuffer.setLength(0);
        }
        return byteBuffer;
    }
{@link java.nio.ByteBuffer} backed input stream.
clickhouse-data/src/main/java/com/clickhouse/data/stream/AbstractByteBufferInputStream.java