public static void writeString(OutputStream output, String value, Charset charset) throws IOException {
        byte[] bytes = value.getBytes(charset == null ? StandardCharsets.UTF_8 : charset);

        writeVarInt(output, bytes.length);
        output.write(bytes);
    }
Write a string to given output stream.

@param output  non-null output stream
@param value   string
@param charset charset used to convert string to byte array, null means UTF-8
@throws IOException when failed to write value to output stream or reached
                    end of the stream
clickhouse-data/src/main/java/com/clickhouse/data/format/BinaryStreamUtils.java