public class StringConverter extends Object implements Converter
Converter implementation that only supports serializing to strings. When converting Kafka Connect data to bytes,
the schema will be ignored and Object.toString() will always be invoked to convert the data to a String.
When converting from bytes to Kafka Connect format, the converter will only ever return an optional string schema and
a string or null.
Encoding configuration is identical to StringSerializer and StringDeserializer, but for convenience
this class can also be configured to use the same encoding for both encoding and decoding with the converter.encoding
setting.| Constructor and Description |
|---|
StringConverter() |
| Modifier and Type | Method and Description |
|---|---|
void |
configure(Map<String,?> configs,
boolean isKey)
Configure this class.
|
byte[] |
fromConnectData(String topic,
Schema schema,
Object value)
Convert a Kafka Connect data object to a native object for serialization.
|
SchemaAndValue |
toConnectData(String topic,
byte[] value)
Convert a native object to a Kafka Connect data object.
|
public void configure(Map<String,?> configs, boolean isKey)
Converterpublic byte[] fromConnectData(String topic, Schema schema, Object value)
ConverterfromConnectData in interface Convertertopic - the topic associated with the dataschema - the schema for the valuevalue - the value to convertpublic SchemaAndValue toConnectData(String topic, byte[] value)
ConvertertoConnectData in interface Convertertopic - the topic associated with the datavalue - the value to convertSchema and the converted value