Class StringOrBytesSerializer
- java.lang.Object
-
- org.springframework.kafka.support.serializer.StringOrBytesSerializer
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,org.apache.kafka.common.serialization.Serializer<java.lang.Object>
public class StringOrBytesSerializer extends java.lang.Object implements org.apache.kafka.common.serialization.Serializer<java.lang.Object>
A serializer that can handlebyte[]
,Bytes
andString
. Convenient when used with one of the Json message converters.- Since:
- 2.3
- Author:
- Gary Russell
-
-
Constructor Summary
Constructors Constructor Description StringOrBytesSerializer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
configure(java.util.Map<java.lang.String,?> configs, boolean isKey)
byte[]
serialize(java.lang.String topic, java.lang.Object data)
-
-
-
Method Detail
-
configure
public void configure(java.util.Map<java.lang.String,?> configs, boolean isKey)
- Specified by:
configure
in interfaceorg.apache.kafka.common.serialization.Serializer<java.lang.Object>
-
serialize
public byte[] serialize(java.lang.String topic, java.lang.Object data)
- Specified by:
serialize
in interfaceorg.apache.kafka.common.serialization.Serializer<java.lang.Object>
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceorg.apache.kafka.common.serialization.Serializer<java.lang.Object>
-
-