Package com.io7m.cardant.protocol.api

# Interface CAProtocolMessagesType<T extends CAProtocolMessageType>

Type Parameters:
  `T` - The type of protocol messages

All Known Implementing Classes:
  `CAI1Messages`

public interface CAProtocolMessagesType<T extends CAProtocolMessageType>
The interface exposed by protocol message handlers.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `T`
  `parse(byte[] data)`
  Parse a message from the given bytes.
  `byte[]`
  `serialize(T message)`
  Serialize the given message to a byte array.

- ## Method Details

  - ### parse

    T parse(byte[] data) throws CAProtocolException
    Parse a message from the given bytes.
    Parameters:
      `data` - The bytes
    Returns:
      A parsed message
    Throws:
      `CAProtocolException` - If parsing fails

  - ### serialize

    byte[] serialize(T message) throws CAProtocolException
    Serialize the given message to a byte array.
    Parameters:
      `message` - The message
    Returns:
      The serialized message as a byte array
    Throws:
      `CAProtocolException` - If serialization fails