Package anbxj

Class Channel_JavaFramedSerializer

java.lang.Object
anbxj.Channel_JavaFramedSerializer
All Implemented Interfaces:
Channel_MessageSerializer

public final class Channel_JavaFramedSerializer extends Object implements Channel_MessageSerializer
A Channel_MessageSerializer that delegates to standard Java object serialisation via the utility methods in Crypto_SerializationUtils.

This serializer does not provide per-step message schemas - every protocol object is serialised as an opaque blob using Java serialisation, exactly as the traditional unstyled channels do. It is intended for situations where a length-delimited wire format is desired without adopting a schema-based format like Protocol Buffers.

Because it uses the same Java serialisation as the existing channels, the wire content is identical; only the framing (a varint length prefix) differs.

See Also:
  • Field Details

  • Method Details

    • serialize

      public byte[] serialize(Object message, int step) throws IOException
      Description copied from interface: Channel_MessageSerializer
      Serializes a logical protocol message into a byte array.
      Specified by:
      serialize in interface Channel_MessageSerializer
      Parameters:
      message - the object to send; the concrete type depends on the protocol step (e.g., String, Crypto_SealedPair, Object[] for tuples)
      step - the protocol step number (starting from 1), used to identify the message format
      Returns:
      the serialized bytes, ready to be written to the network
      Throws:
      IOException - if serialization fails
    • deserialize

      public Object deserialize(byte[] data, int step) throws IOException, ClassNotFoundException
      Description copied from interface: Channel_MessageSerializer
      Deserializes a byte array back into a logical protocol message object.
      Specified by:
      deserialize in interface Channel_MessageSerializer
      Parameters:
      data - the raw bytes received from the network
      step - the expected protocol step number, used to identify the message format and recreate the appropriate object
      Returns:
      the reconstructed protocol object (e.g., String, Crypto_SealedPair, Object[])
      Throws:
      IOException - if deserialization fails
      ClassNotFoundException - if a required class cannot be found (may occur when internal Java serialization is used inside cryptographic wrappers)