Class ImageMessageFlyweight

java.lang.Object
io.aeron.command.ImageMessageFlyweight

public class ImageMessageFlyweight extends Object
Control message flyweight for any message that needs to represent a connection.
   0                   1                   2                   3
   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                       Correlation ID                          |
  |                                                               |
  +---------------------------------------------------------------+
  |                 Subscription Registration ID                  |
  |                                                               |
  +---------------------------------------------------------------+
  |                          Stream ID                            |
  +---------------------------------------------------------------+
  |                       Channel Length                          |
  +---------------------------------------------------------------+
  |                       Channel (ASCII)                        ...
 ...                                                              |
  +---------------------------------------------------------------+
 
  • Constructor Details

    • ImageMessageFlyweight

      public ImageMessageFlyweight()
  • Method Details

    • wrap

      public final ImageMessageFlyweight wrap(MutableDirectBuffer buffer, int offset)
      Wrap the buffer at a given offset for updates.
      Parameters:
      buffer - to wrap
      offset - at which the message begins.
      Returns:
      this for a fluent API.
    • correlationId

      public long correlationId()
      The correlation id field.
      Returns:
      correlation id field.
    • correlationId

      public ImageMessageFlyweight correlationId(long correlationId)
      Set the correlation id field.
      Parameters:
      correlationId - field value.
      Returns:
      this for a fluent API.
    • subscriptionRegistrationId

      public long subscriptionRegistrationId()
      Registration ID for the subscription.
      Returns:
      registration ID for the subscription.
    • subscriptionRegistrationId

      public ImageMessageFlyweight subscriptionRegistrationId(long registrationId)
      Set the registration ID for the subscription.
      Parameters:
      registrationId - for the subscription.
      Returns:
      this for a fluent API.
    • streamId

      public int streamId()
      The stream id field.
      Returns:
      stream id field.
    • streamId

      public ImageMessageFlyweight streamId(int streamId)
      Set the stream id field.
      Parameters:
      streamId - field value.
      Returns:
      this for a fluent API.
    • channel

      public String channel()
      Get the channel field as ASCII.
      Returns:
      channel field.
    • appendChannel

      public void appendChannel(Appendable appendable)
      Append the channel value to an Appendable.
      Parameters:
      appendable - to append channel to.
    • channel

      public ImageMessageFlyweight channel(String channel)
      Set the channel field as ASCII.
      Parameters:
      channel - field value.
      Returns:
      this for a fluent API.
    • length

      public int length()
      Get the length of the current message.

      NB: must be called after the data is written in order to be accurate.

      Returns:
      the length of the current message.