@Override
    public ClickHouseOutputStream transferBytes(byte[] bytes, int offset, int length) throws IOException {
        if (bytes == null) {
            throw new NullPointerException();
        } else if (offset < 0 || length < 0 || length > bytes.length - offset) {
            throw new IndexOutOfBoundsException();
        } else if (length == 0) {
            return this;
        }
        ensureOpen();

        ByteBuffer b = buffer;
        if (b.position() > 0) {
            updateBuffer(true);
        }
        updateBuffer(ByteBuffer.wrap(bytes, offset, length));

        return this;
    }
A combination of {@link java.io.PipedOutputStream} and
{@link java.io.PipedInputStream} for streaming data between server and
client. To avoid dead lock and high memory usage, please make sure writer and
reader are on two separate threads.
clickhouse-data/src/main/java/com/clickhouse/data/stream/BlockingPipedOutputStream.java