Package org.apache.kafka.connect.storage
Class SimpleHeaderConverter
- java.lang.Object
- 
- org.apache.kafka.connect.storage.SimpleHeaderConverter
 
- 
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- Configurable,- HeaderConverter
 
 public class SimpleHeaderConverter extends Object implements HeaderConverter AHeaderConverterthat 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 SummaryConstructors Constructor Description SimpleHeaderConverter()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()ConfigDefconfig()Configuration specification for this set of header converters.voidconfigure(Map<String,?> configs)Configure this class with the given key-value pairsbyte[]fromConnectHeader(String topic, String headerKey, Schema schema, Object value)SchemaAndValuetoConnectHeader(String topic, String headerKey, byte[] value)Convert the header name and byte array value into aHeaderobject.
 
- 
- 
- 
Method Detail- 
configpublic ConfigDef config() Description copied from interface:HeaderConverterConfiguration specification for this set of header converters.- Specified by:
- configin interface- HeaderConverter
- Returns:
- the configuration specification; may not be null
 
 - 
configurepublic void configure(Map<String,?> configs) Description copied from interface:ConfigurableConfigure this class with the given key-value pairs- Specified by:
- configurein interface- Configurable
 
 - 
toConnectHeaderpublic SchemaAndValue toConnectHeader(String topic, String headerKey, byte[] value) Description copied from interface:HeaderConverterConvert the header name and byte array value into aHeaderobject.- Specified by:
- toConnectHeaderin interface- HeaderConverter
- Parameters:
- topic- the name of the topic for the record containing the header
- headerKey- the header's key; may not be null
- value- the header's raw value; may be null
- Returns:
- the SchemaAndValue; may not be null
 
 - 
fromConnectHeaderpublic byte[] fromConnectHeader(String topic, String headerKey, Schema schema, Object value) Description copied from interface:HeaderConverter- Specified by:
- fromConnectHeaderin interface- HeaderConverter
- Parameters:
- topic- the name of the topic for the record containing the header
- headerKey- the header's key; may not be null
- schema- the schema for the header's value; may be null
- value- the header's value to convert; may be null
- Returns:
- the byte array form of the Header's value; may be null if the value is null
 
 - 
closepublic void close() throws IOException- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Throws:
- IOException
 
 
- 
 
-