Interface MessageSerializer

All Superinterfaces:
no.mnemonic.commons.metrics.MetricAspect
All Known Implementing Classes:
DefaultJavaMessageSerializer, XStreamMessageSerializer

public interface MessageSerializer extends no.mnemonic.commons.metrics.MetricAspect
  • Method Summary

    Modifier and Type
    Method
    Description
    <T extends Message>
    T
    deserialize(byte[] msgbytes, ClassLoader classLoader)
    Deserialize bytes into a message
    byte[]
    Serialize the message
     

    Methods inherited from interface no.mnemonic.commons.metrics.MetricAspect

    getMetrics
  • Method Details

    • serializerID

      String serializerID()
      Returns:
      a serializer identifier, to allow JMS receiver to distinguish between sender formats
    • serialize

      byte[] serialize(Message msg) throws IOException
      Serialize the message
      Parameters:
      msg - message to serialize
      Returns:
      message in serialized format
      Throws:
      IOException - if serialization fails
    • deserialize

      <T extends Message> T deserialize(byte[] msgbytes, ClassLoader classLoader) throws IOException
      Deserialize bytes into a message
      Type Parameters:
      T - expected message type
      Parameters:
      msgbytes - message bytes
      classLoader - classloader which knows any involved types
      Returns:
      the deserialized message
      Throws:
      IOException - if deserialization fails