public CompletableFuture<InsertResponse> insert(String tableName,
                                                    List<String> columnNames,
                                                    InputStream data,
                                                    ClickHouseFormat format,
                                                    InsertSettings settings) {

        final int writeBufferSize = settings.getInputStreamCopyBufferSize() <= 0 ?
                Integer.parseInt(configuration.getOrDefault(ClientConfigProperties.CLIENT_NETWORK_BUFFER_SIZE.getKey(),
                        ClientConfigProperties.CLIENT_NETWORK_BUFFER_SIZE.getDefaultValue())) :
                settings.getInputStreamCopyBufferSize();

        if (writeBufferSize <= 0) {
            throw new IllegalArgumentException("Buffer size must be greater than 0");
        }

        return insert(tableName, columnNames, new DataStreamWriter() {
                    @Override
                    public void onOutput(OutputStream out) throws IOException {
                        byte[] buffer = new byte[writeBufferSize];
                        int bytesRead;
                        while ((bytesRead = data.read(buffer)) > 0) {
                            out.write(buffer, 0, bytesRead);
                        }
                        out.close();
                    }

                    @Override
                    public void onRetry() throws IOException {
                        data.reset();
                    }
                },
                format, settings);
    }
Sends write request to database. Input data is read from the input stream.

@param tableName - destination table name
@param columnNames - list of column names to insert data into. If null or empty, all columns will be used.
@param data  - data stream to insert
@param format - format of the data in the stream
@param settings - insert operation settings
@return {@code CompletableFuture<InsertResponse>} - a promise to insert response
client-v2/src/main/java/com/clickhouse/client/api/Client.java