public RecordWriter getRecordWriter()

in src/main/java/com/microsoft/azure/kusto/kafka/connect/sink/formatWriter/StringRecordWriterProvider.java [19:47]


    public RecordWriter getRecordWriter(String filename, OutputStream out) {
        return new RecordWriter() {

            @Override
            public void write(SinkRecord record) throws IOException {
                byte[] value = null;
                value = String.format("%s\n", record.value()).getBytes(StandardCharsets.UTF_8);
                out.write(value);
            }

            @Override
            public void close() {
                try {
                    out.close();
                } catch (IOException e) {
                    throw new DataException(e);
                }
            }

            @Override
            public void commit() {
                try {
                    out.flush();
                } catch (IOException e) {
                    throw new DataException(e);
                }
            }
        };
    }