public static long pipe(InputStream input, OutputStream output, int bufferSize) throws IOException {
        if (input instanceof ClickHouseInputStream && output instanceof ClickHouseOutputStream) {
            return ((ClickHouseInputStream) input).pipe((ClickHouseOutputStream) output);
        }

        return pipe(input, output, new byte[ClickHouseDataConfig.getBufferSize(bufferSize)]);
    }
Transfers data from input stream to output stream. Input stream will be
closed but output stream will remain open. Please pay attention that you need
to explictly call {@code output.flush()} before closing output stream.

@param input      non-null input stream, which will be closed
@param output     non-null output stream, which will remain open
@param bufferSize buffer size, zero or negative number will be treated as
                  {@link ClickHouseDataConfig#DEFAULT_BUFFER_SIZE}
@return written bytes
@throws IOException when error occured reading from input stream or writing
                    data to output stream
clickhouse-data/src/main/java/com/clickhouse/data/ClickHouseInputStream.java