java.io.Closeable
, java.lang.AutoCloseable
, Configurable
, HeaderConverter
public class SimpleHeaderConverter extends java.lang.Object implements HeaderConverter
HeaderConverter
that serializes header values as strings and that deserializes header values to the most appropriate
numeric, boolean, array, or map representation. Schemas are not serialized, but are inferred upon deserialization when possible.Constructor | Description |
---|---|
SimpleHeaderConverter() |
Modifier and Type | Method | Description |
---|---|---|
void |
close() |
|
ConfigDef |
config() |
Configuration specification for this set of header converters.
|
void |
configure(java.util.Map<java.lang.String,?> configs) |
Configure this class with the given key-value pairs
|
byte[] |
fromConnectHeader(java.lang.String topic,
java.lang.String headerKey,
Schema schema,
java.lang.Object value) |
|
SchemaAndValue |
toConnectHeader(java.lang.String topic,
java.lang.String headerKey,
byte[] value) |
Convert the header name and byte array value into a
Header object. |
public ConfigDef config()
HeaderConverter
config
in interface HeaderConverter
public void configure(java.util.Map<java.lang.String,?> configs)
Configurable
configure
in interface Configurable
public SchemaAndValue toConnectHeader(java.lang.String topic, java.lang.String headerKey, byte[] value)
HeaderConverter
Header
object.toConnectHeader
in interface HeaderConverter
topic
- the name of the topic for the record containing the headerheaderKey
- the header's key; may not be nullvalue
- the header's raw value; may be nullSchemaAndValue
; may not be nullpublic byte[] fromConnectHeader(java.lang.String topic, java.lang.String headerKey, Schema schema, java.lang.Object value)
HeaderConverter
fromConnectHeader
in interface HeaderConverter
topic
- the name of the topic for the record containing the headerheaderKey
- the header's key; may not be nullschema
- the schema for the header's value; may be nullvalue
- the header's value to convert; may be nullpublic void close() throws java.io.IOException
close
in interface java.lang.AutoCloseable
close
in interface java.io.Closeable
java.io.IOException