public final void setCopyToTarget(OutputStream out) throws IOException {
        if (this.copyTo != null) {
            this.copyTo.flush();
        } else if (out != null) {
            ClickHouseByteBuffer buf = getBuffer();
            if (!buf.isEmpty()) {
                out.write(buf.array(), buf.position(), buf.length());
            }
        }
        this.copyTo = out;
    }
Sets target output stream to copy bytes to. This is mainly used for
testing, for example: dump input into a file while reading.

@param out the output stream to write bytes to
@throws IOException when failed to flush previous target or not able to write
                    remaining bytes in buffer to the given output stream
clickhouse-data/src/main/java/com/clickhouse/data/ClickHouseInputStream.java