org.apache.kafka.common.serialization
Class StringSerializer
java.lang.Object
org.apache.kafka.common.serialization.StringSerializer
- All Implemented Interfaces:
- Serializer<java.lang.String>
public class StringSerializer
- extends java.lang.Object
- implements Serializer<java.lang.String>
String encoding defaults to UTF8 and can be customized by setting the property key.serializer.encoding,
value.serializer.encoding or serializer.encoding. The first two take precedence over the last.
Method Summary |
void |
close()
Close this serializer |
void |
configure(java.util.Map<java.lang.String,?> configs,
boolean isKey)
Configure this class. |
byte[] |
serialize(java.lang.String topic,
java.lang.String data)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StringSerializer
public StringSerializer()
configure
public void configure(java.util.Map<java.lang.String,?> configs,
boolean isKey)
- Description copied from interface:
Serializer
- Configure this class.
- Specified by:
configure
in interface Serializer<java.lang.String>
- Parameters:
configs
- configs in key/value pairsisKey
- whether is for key or value
serialize
public byte[] serialize(java.lang.String topic,
java.lang.String data)
- Specified by:
serialize
in interface Serializer<java.lang.String>
- Parameters:
topic
- topic associated with datadata
- typed data
- Returns:
- serialized bytes
close
public void close()
- Description copied from interface:
Serializer
- Close this serializer
- Specified by:
close
in interface Serializer<java.lang.String>