Class StringSerializer
- java.lang.Object
-
- com.linkedin.venice.serialization.StringSerializer
-
- All Implemented Interfaces:
VeniceKafkaSerializer<java.lang.String>
,java.io.Closeable
,java.lang.AutoCloseable
,org.apache.kafka.common.serialization.Deserializer<java.lang.String>
,org.apache.kafka.common.serialization.Serializer<java.lang.String>
public class StringSerializer extends java.lang.Object implements VeniceKafkaSerializer<java.lang.String>
-
-
Constructor Summary
Constructors Constructor Description StringSerializer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close this serializer.void
configure(java.util.Map<java.lang.String,?> configMap, boolean isKey)
Configure this class.java.lang.String
deserialize(java.lang.String topic, byte[] byteArray)
Create an object from an array of bytesbyte[]
serialize(java.lang.String topic, java.lang.String string)
Construct an array of bytes from the given object
-
-
-
Method Detail
-
deserialize
public java.lang.String deserialize(java.lang.String topic, byte[] byteArray)
Description copied from interface:VeniceKafkaSerializer
Create an object from an array of bytes- Specified by:
deserialize
in interfaceorg.apache.kafka.common.serialization.Deserializer<java.lang.String>
- Specified by:
deserialize
in interfaceVeniceKafkaSerializer<java.lang.String>
- Parameters:
topic
- Topic to which the array of bytes belongs.byteArray
- An array of bytes with the objects data- Returns:
- A java object serialzed from the bytes
-
close
public void close()
Close this serializer. This method has to be idempotent if the serializer is used in KafkaProducer because it might be called multiple times.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceorg.apache.kafka.common.serialization.Deserializer<java.lang.String>
- Specified by:
close
in interfaceorg.apache.kafka.common.serialization.Serializer<java.lang.String>
- Specified by:
close
in interfaceVeniceKafkaSerializer<java.lang.String>
-
configure
public void configure(java.util.Map<java.lang.String,?> configMap, boolean isKey)
Configure this class.- Specified by:
configure
in interfaceorg.apache.kafka.common.serialization.Deserializer<java.lang.String>
- Specified by:
configure
in interfaceorg.apache.kafka.common.serialization.Serializer<java.lang.String>
- Specified by:
configure
in interfaceVeniceKafkaSerializer<java.lang.String>
- Parameters:
configMap
- configs in key/value pairsisKey
- whether is for key or value
-
serialize
public byte[] serialize(java.lang.String topic, java.lang.String string)
Description copied from interface:VeniceKafkaSerializer
Construct an array of bytes from the given object- Specified by:
serialize
in interfaceorg.apache.kafka.common.serialization.Serializer<java.lang.String>
- Specified by:
serialize
in interfaceVeniceKafkaSerializer<java.lang.String>
- Parameters:
topic
- Topic to which the object belongs.string
- The object- Returns:
- The bytes taken from the object
-
-