Class SDPMessage

java.lang.Object
uk.ac.manchester.spinnaker.messages.sdp.SpinnakerRequest
uk.ac.manchester.spinnaker.messages.sdp.SDPMessage
All Implemented Interfaces:
SerializableMessage
Direct Known Subclasses:
GatherProtocolMessage

public class SDPMessage
extends SpinnakerRequest
Wraps up an SDP message with a header and optional data.
  • Constructor Details

    • SDPMessage

      public SDPMessage​(SDPHeader header)
      Create an SDP message with no payload.
      Parameters:
      header - the message header.
    • SDPMessage

      public SDPMessage​(SDPHeader header, byte[] data)
      Create an SDP message with a payload.
      Parameters:
      header - the message header.
      data - the message payload.
    • SDPMessage

      public SDPMessage​(SDPHeader header, byte[] data, int offset)
      Create an SDP message with a payload.
      Parameters:
      header - the message header.
      data - the message payload.
      offset - where in the array the payload starts.
    • SDPMessage

      public SDPMessage​(SDPHeader header, byte[] data, int offset, int length)
      Create an SDP message with a payload.
      Parameters:
      header - the message header.
      data - the message payload.
      offset - where in the array the payload starts.
      length - the length of the payload in the array.
    • SDPMessage

      public SDPMessage​(SDPHeader header, ByteBuffer data)
      Create an SDP message with a payload.
      Parameters:
      header - the message header.
      data - the message payload, in the region from the position to the limit.
    • SDPMessage

      public SDPMessage​(ByteBuffer buffer, boolean isBMP)
      Deserialises an SDP message from a buffer.
      Parameters:
      buffer - The buffer holding the message.
      isBMP - Whether we're really talking to a BMP
  • Method Details

    • addToBuffer

      public void addToBuffer​(ByteBuffer buffer)
      Description copied from interface: SerializableMessage
      Writes this message into the given buffer as a contiguous range of bytes. This is so that a message can be sent. Implementors may assume that the buffer has been configured to be little-endian and that its position is at the point where they should begin writing. Once it has finished, the position should be immediately after the last byte written by this method.

      Calling this method should not update the internal state of the message. It should be possible to add the message to multiple buffers without special precautions by the caller.

      Parameters:
      buffer - The buffer to write into.
    • getData

      public final ByteBuffer getData()
      Returns:
      The payload of the message, as a read-only little-endian buffer.