kafka-1797; (addressing Manikumar Reddy's comment) add the serializer/deserializer api to the new java client; patched by Jun Rao; reviewed by Manikumar Reddy and Neha Narkhede
@ -37,7 +37,10 @@ public class StringDeserializer implements Deserializer<String> {
@@ -37,7 +37,10 @@ public class StringDeserializer implements Deserializer<String> {
@Override
publicStringdeserialize(Stringtopic,byte[]data){
try{
returnnewString(data,encoding);
if(data==null)
returnnull;
else
returnnewString(data,encoding);
}catch(UnsupportedEncodingExceptione){
thrownewSerializationException("Error when deserializing byte[] to string due to unsupported encoding "+encoding);
@ -37,7 +37,10 @@ public class StringSerializer implements Serializer<String> {
@@ -37,7 +37,10 @@ public class StringSerializer implements Serializer<String> {
@Override
publicbyte[]serialize(Stringtopic,Stringdata){
try{
returndata.getBytes(encoding);
if(data==null)
returnnull;
else
returndata.getBytes(encoding);
}catch(UnsupportedEncodingExceptione){
thrownewSerializationException("Error when serializing string to byte[] due to unsupported encoding "+encoding);