Class OperationSerializer


  • public class OperationSerializer
    extends Object
    OperationSerializer is responsible for the serialization and deserialization of an Operation.
    • Constructor Detail

      • OperationSerializer

        public OperationSerializer()
    • Method Detail

      • serialize

        public void serialize​(Operation request,
                              DataOutputStream out)
        Serializes the given Operation to the provided DataOutputStream.
        Parameters:
        request - the Operation to serialize
        out - the DataOutputStream to which the Operation will be serialized
      • deserialize

        public Operation deserialize​(long requestSize,
                                     DataInputStream in)
        Deserializes an Operation from the provided DataInputStream.
        Parameters:
        requestSize - the size of the request in bytes
        in - the DataInputStream from which the Operation will be deserialized
        Returns:
        the deserialized Operation, or null if deserialization fails
      • size

        public int size​(Operation operation)
        Calculates the serialized size of the given Operation.
        Parameters:
        operation - the Operation whose size is to be calculated
        Returns:
        the size of the serialized Operation in bytes