Class HeaderFlyweight

All Implemented Interfaces:
Comparable<DirectBuffer>, AtomicBuffer, DirectBuffer, MutableDirectBuffer
Direct Known Subclasses:
DataHeaderFlyweight, ErrorFlyweight, NakFlyweight, ResolutionEntryFlyweight, ResponseSetupFlyweight, RttMeasurementFlyweight, SetupFlyweight, StatusMessageFlyweight

public class HeaderFlyweight extends UnsafeBuffer
Flyweight for general Aeron network protocol header of a message frame.
   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
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                        Frame Length                           |
  +---------------------------------------------------------------+
  |  Version    |     Flags     |               Type              |
  +-------------+---------------+---------------------------------+
  |                       Depends on Type                        ...
 
  • Field Details

    • HDR_TYPE_PAD

      public static final int HDR_TYPE_PAD
      Header type PAD.
      See Also:
    • HDR_TYPE_DATA

      public static final int HDR_TYPE_DATA
      Header type DATA.
      See Also:
    • HDR_TYPE_NAK

      public static final int HDR_TYPE_NAK
      Header type NAK.
      See Also:
    • HDR_TYPE_SM

      public static final int HDR_TYPE_SM
      Header type SM.
      See Also:
    • HDR_TYPE_ERR

      public static final int HDR_TYPE_ERR
      Header type ERR.
      See Also:
    • HDR_TYPE_SETUP

      public static final int HDR_TYPE_SETUP
      Header type SETUP.
      See Also:
    • HDR_TYPE_RTTM

      public static final int HDR_TYPE_RTTM
      Header type RTT Measurement.
      See Also:
    • HDR_TYPE_RES

      public static final int HDR_TYPE_RES
      Header type RESOLUTION.
      See Also:
    • HDR_TYPE_ATS_DATA

      public static final int HDR_TYPE_ATS_DATA
      Header type ATS Data.
      See Also:
    • HDR_TYPE_ATS_SM

      public static final int HDR_TYPE_ATS_SM
      Header type ATS Status Message.
      See Also:
    • HDR_TYPE_ATS_SETUP

      public static final int HDR_TYPE_ATS_SETUP
      Header type ATS Setup.
      See Also:
    • HDR_TYPE_RSP_SETUP

      public static final int HDR_TYPE_RSP_SETUP
      Header type Response Setup.
      See Also:
    • HDR_TYPE_EXT

      public static final int HDR_TYPE_EXT
      Header type EXT.
      See Also:
    • CURRENT_VERSION

      public static final byte CURRENT_VERSION
      Default version.
      See Also:
    • FRAME_LENGTH_FIELD_OFFSET

      public static final int FRAME_LENGTH_FIELD_OFFSET
      Offset in the frame at which the frame length field begins.
      See Also:
    • VERSION_FIELD_OFFSET

      public static final int VERSION_FIELD_OFFSET
      Offset in the frame at which the version field begins.
      See Also:
    • FLAGS_FIELD_OFFSET

      public static final int FLAGS_FIELD_OFFSET
      Offset in the frame at which the flags field begins.
      See Also:
    • TYPE_FIELD_OFFSET

      public static final int TYPE_FIELD_OFFSET
      Offset in the frame at which the frame type field begins.
      See Also:
    • MIN_HEADER_LENGTH

      public static final int MIN_HEADER_LENGTH
      Minimum length of any Aeron frame.
      See Also:
  • Constructor Details

    • HeaderFlyweight

      public HeaderFlyweight()
      Default constructor which can later be used to wrap a frame.
    • HeaderFlyweight

      public HeaderFlyweight(UnsafeBuffer buffer)
      Construct a flyweight which wraps a UnsafeBuffer over the frame.
      Parameters:
      buffer - to wrap for the flyweight.
    • HeaderFlyweight

      public HeaderFlyweight(ByteBuffer buffer)
      Construct a flyweight which wraps a ByteBuffer over the frame.
      Parameters:
      buffer - to wrap for the flyweight.
  • Method Details

    • version

      public short version()
      The version field value.
      Returns:
      version field value.
    • version

      public HeaderFlyweight version(short version)
      Set the version field value.
      Parameters:
      version - field value to be set.
      Returns:
      this for a fluent API.
    • flags

      public short flags()
      The flags field value.
      Returns:
      the flags field value.
    • flags

      public HeaderFlyweight flags(short flags)
      Set the flags field value.
      Parameters:
      flags - field value.
      Returns:
      this for a fluent API.
    • headerType

      public int headerType()
      The type field value.
      Returns:
      the type field value.
    • headerType

      public HeaderFlyweight headerType(int type)
      Set the type field value.
      Parameters:
      type - field value.
      Returns:
      this for a fluent API.
    • frameLength

      public int frameLength()
      The length of the frame field value.
      Returns:
      length of the frame field value.
    • frameLength

      public HeaderFlyweight frameLength(int length)
      Set the length of the frame field value.
      Parameters:
      length - field value.
      Returns:
      this for a fluent API.
    • flagsToChars

      public static char[] flagsToChars(short flags)
      Convert header flags to an array of chars to be human-readable.
      Parameters:
      flags - to be converted.
      Returns:
      header flags converted to an array of chars to be human-readable.
    • appendFlagsAsChars

      public static void appendFlagsAsChars(short flags, Appendable appendable)
      Append header flags to an Appendable to be human-readable.
      Parameters:
      flags - to be converted.
      appendable - to append flags to.