@Override
    protected void ensureOpen() throws IOException {
        super.ensureOpen();

        if (buffer == null || (buffer != ClickHouseByteBuffer.EMPTY_BUFFER && !buffer.hasRemaining())) {
            updateBuffer();
        }
    }
{@link java.nio.ByteBuffer} backed input stream.
clickhouse-data/src/main/java/com/clickhouse/data/stream/AbstractByteBufferInputStream.java