Yuta HIGUCHI

Unified method names to encode/decode

Change-Id: I6bd77bb740b758981f29cee10bc11abab1b1db1b
......@@ -45,12 +45,12 @@ public class KryoSerializer implements Serializer {
}
@Override
public <T> T deserialize(ByteBuffer buffer) {
public <T> T decode(ByteBuffer buffer) {
return serializerPool.deserialize(buffer);
}
@Override
public void serialize(Object obj, ByteBuffer buffer) {
public void encode(Object obj, ByteBuffer buffer) {
serializerPool.serialize(obj, buffer);
}
}
......
......@@ -48,7 +48,7 @@ public class MessageDecoder extends ReplayingDecoder<DecoderState> {
checkState(serializerVersion == MessageEncoder.SERIALIZER_VERSION, "Unexpected serializer version");
checkpoint(DecoderState.READ_CONTENT);
case READ_CONTENT:
InternalMessage message = serializer.deserialize(buffer.readBytes(contentLength).nioBuffer());
InternalMessage message = serializer.decode(buffer.readBytes(contentLength).nioBuffer());
message.setMessagingService(messagingService);
out.add(message);
checkpoint(DecoderState.READ_HEADER_VERSION);
......
......@@ -24,20 +24,18 @@ public interface Serializer {
public byte[] encode(Object data);
/**
* Serializes the specified object into bytes using one of the
* pre-registered serializers.
* Encodes the specified POJO into a byte buffer.
*
* @param obj object to be serialized
* @param data POJO to be encoded
* @param buffer to write serialized bytes
*/
public void serialize(final Object obj, ByteBuffer buffer);
public void encode(final Object data, ByteBuffer buffer);
/**
* Deserializes the specified bytes into an object using one of the
* pre-registered serializers.
* Decodes the specified byte buffer to a POJO.
*
* @param buffer bytes to be deserialized
* @return deserialized object
* @param buffer bytes to be decoded
* @return POJO
*/
public <T> T deserialize(final ByteBuffer buffer);
public <T> T decode(final ByteBuffer buffer);
}
......