Package io.aeron.protocol
Class HeaderFlyweight
java.lang.Object
org.agrona.AbstractMutableDirectBuffer
org.agrona.concurrent.UnsafeBuffer
io.aeron.protocol.HeaderFlyweight
- All Implemented Interfaces:
Comparable<DirectBuffer>,AtomicBuffer,DirectBuffer,MutableDirectBuffer
- Direct Known Subclasses:
DataHeaderFlyweight,ErrorFlyweight,NakFlyweight,ResolutionEntryFlyweight,ResponseSetupFlyweight,RttMeasurementFlyweight,SetupFlyweight,StatusMessageFlyweight
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final byteDefault version.static final intOffset in the frame at which the flags field begins.static final intOffset in the frame at which the frame length field begins.static final intHeader type ATS Data.static final intHeader type ATS Setup.static final intHeader type ATS Status Message.static final intHeader type DATA.static final intHeader type ERR.static final intHeader type EXT.static final intHeader type NAK.static final intHeader type PAD.static final intHeader type RESOLUTION.static final intHeader type Response Setup.static final intHeader type RTT Measurement.static final intHeader type SETUP.static final intHeader type SM.static final intMinimum length of any Aeron frame.static final intOffset in the frame at which the frame type field begins.static final intOffset in the frame at which the version field begins.Fields inherited from class org.agrona.concurrent.UnsafeBuffer
ALIGNMENT, DISABLE_BOUNDS_CHECKS_PROP_NAME, SHOULD_BOUNDS_CHECKFields inherited from class org.agrona.AbstractMutableDirectBuffer
addressOffset, byteArray, capacityFields inherited from interface org.agrona.concurrent.AtomicBuffer
STRICT_ALIGNMENT_CHECKS, STRICT_ALIGNMENT_CHECKS_PROP_NAMEFields inherited from interface org.agrona.DirectBuffer
DISABLE_ARRAY_CONTENT_PRINTOUT_PROP_NAME, STR_HEADER_LEN -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor which can later be used to wrap a frame.HeaderFlyweight(ByteBuffer buffer) Construct a flyweight which wraps aByteBufferover the frame.HeaderFlyweight(UnsafeBuffer buffer) Construct a flyweight which wraps aUnsafeBufferover the frame. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidappendFlagsAsChars(short flags, Appendable appendable) Append header flags to anAppendableto be human-readable.shortflags()The flags field value.flags(short flags) Set the flags field value.static char[]flagsToChars(short flags) Convert header flags to an array of chars to be human-readable.intThe length of the frame field value.frameLength(int length) Set the length of the frame field value.intThe type field value.headerType(int type) Set the type field value.shortversion()The version field value.version(short version) Set the version field value.Methods inherited from class org.agrona.concurrent.UnsafeBuffer
addIntOpaque, addIntOrdered, addIntRelease, addLongOpaque, addLongOrdered, addLongRelease, byteBuffer, compareAndExchangeInt, compareAndExchangeLong, compareAndSetInt, compareAndSetLong, ensureCapacity, getAndAddInt, getAndAddLong, getAndSetInt, getAndSetLong, getByteVolatile, getCharVolatile, getIntAcquire, getIntOpaque, getIntVolatile, getLongAcquire, getLongOpaque, getLongVolatile, getShortVolatile, isExpandable, putByteVolatile, putCharVolatile, putIntOpaque, putIntOrdered, putIntRelease, putIntVolatile, putLongOpaque, putLongOrdered, putLongRelease, putLongVolatile, putShortVolatile, toString, verifyAlignment, wrap, wrap, wrap, wrap, wrap, wrap, wrap, wrapAdjustmentMethods inherited from class org.agrona.AbstractMutableDirectBuffer
addressOffset, boundsCheck, boundsCheck0, byteArray, capacity, checkLimit, compareTo, equals, getByte, getBytes, getBytes, getBytes, getBytes, getBytes, getChar, getChar, getDouble, getDouble, getFloat, getFloat, getInt, getInt, getLong, getLong, getShort, getShort, getStringAscii, getStringAscii, getStringAscii, getStringAscii, getStringAscii, getStringAscii, getStringUtf8, getStringUtf8, getStringUtf8, getStringWithoutLengthAscii, getStringWithoutLengthAscii, getStringWithoutLengthUtf8, hashCode, parseIntAscii, parseLongAscii, parseNaturalIntAscii, parseNaturalLongAscii, putByte, putBytes, putBytes, putBytes, putBytes, putBytes, putChar, putChar, putDouble, putDouble, putFloat, putFloat, putInt, putInt, putIntAscii, putLong, putLong, putLongAscii, putNaturalIntAscii, putNaturalIntAsciiFromEnd, putNaturalLongAscii, putNaturalPaddedIntAscii, putShort, putShort, putStringAscii, putStringAscii, putStringAscii, putStringAscii, putStringUtf8, putStringUtf8, putStringUtf8, putStringUtf8, putStringWithoutLengthAscii, putStringWithoutLengthAscii, putStringWithoutLengthAscii, putStringWithoutLengthAscii, putStringWithoutLengthUtf8, setMemoryMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface org.agrona.DirectBuffer
addressOffset, boundsCheck, byteArray, capacity, checkLimit, getByte, getBytes, getBytes, getBytes, getBytes, getBytes, getChar, getChar, getDouble, getDouble, getFloat, getFloat, getInt, getInt, getLong, getLong, getShort, getShort, getStringAscii, getStringAscii, getStringAscii, getStringAscii, getStringAscii, getStringAscii, getStringUtf8, getStringUtf8, getStringUtf8, getStringWithoutLengthAscii, getStringWithoutLengthAscii, getStringWithoutLengthUtf8, parseIntAscii, parseLongAscii, parseNaturalIntAscii, parseNaturalLongAsciiMethods inherited from interface org.agrona.MutableDirectBuffer
putByte, putBytes, putBytes, putBytes, putBytes, putBytes, putChar, putChar, putDouble, putDouble, putFloat, putFloat, putInt, putInt, putIntAscii, putLong, putLong, putLongAscii, putNaturalIntAscii, putNaturalIntAsciiFromEnd, putNaturalLongAscii, putNaturalPaddedIntAscii, putShort, putShort, putStringAscii, putStringAscii, putStringAscii, putStringAscii, putStringUtf8, putStringUtf8, putStringUtf8, putStringUtf8, putStringWithoutLengthAscii, putStringWithoutLengthAscii, putStringWithoutLengthAscii, putStringWithoutLengthAscii, putStringWithoutLengthUtf8, setMemory
-
Field Details
-
HDR_TYPE_PAD
public static final int HDR_TYPE_PADHeader type PAD.- See Also:
-
HDR_TYPE_DATA
public static final int HDR_TYPE_DATAHeader type DATA.- See Also:
-
HDR_TYPE_NAK
public static final int HDR_TYPE_NAKHeader type NAK.- See Also:
-
HDR_TYPE_SM
public static final int HDR_TYPE_SMHeader type SM.- See Also:
-
HDR_TYPE_ERR
public static final int HDR_TYPE_ERRHeader type ERR.- See Also:
-
HDR_TYPE_SETUP
public static final int HDR_TYPE_SETUPHeader type SETUP.- See Also:
-
HDR_TYPE_RTTM
public static final int HDR_TYPE_RTTMHeader type RTT Measurement.- See Also:
-
HDR_TYPE_RES
public static final int HDR_TYPE_RESHeader type RESOLUTION.- See Also:
-
HDR_TYPE_ATS_DATA
public static final int HDR_TYPE_ATS_DATAHeader type ATS Data.- See Also:
-
HDR_TYPE_ATS_SM
public static final int HDR_TYPE_ATS_SMHeader type ATS Status Message.- See Also:
-
HDR_TYPE_ATS_SETUP
public static final int HDR_TYPE_ATS_SETUPHeader type ATS Setup.- See Also:
-
HDR_TYPE_RSP_SETUP
public static final int HDR_TYPE_RSP_SETUPHeader type Response Setup.- See Also:
-
HDR_TYPE_EXT
public static final int HDR_TYPE_EXTHeader type EXT.- See Also:
-
CURRENT_VERSION
public static final byte CURRENT_VERSIONDefault version.- See Also:
-
FRAME_LENGTH_FIELD_OFFSET
public static final int FRAME_LENGTH_FIELD_OFFSETOffset in the frame at which the frame length field begins.- See Also:
-
VERSION_FIELD_OFFSET
public static final int VERSION_FIELD_OFFSETOffset in the frame at which the version field begins.- See Also:
-
FLAGS_FIELD_OFFSET
public static final int FLAGS_FIELD_OFFSETOffset in the frame at which the flags field begins.- See Also:
-
TYPE_FIELD_OFFSET
public static final int TYPE_FIELD_OFFSETOffset in the frame at which the frame type field begins.- See Also:
-
MIN_HEADER_LENGTH
public static final int MIN_HEADER_LENGTHMinimum length of any Aeron frame.- See Also:
-
-
Constructor Details
-
HeaderFlyweight
public HeaderFlyweight()Default constructor which can later be used to wrap a frame. -
HeaderFlyweight
Construct a flyweight which wraps aUnsafeBufferover the frame.- Parameters:
buffer- to wrap for the flyweight.
-
HeaderFlyweight
Construct a flyweight which wraps aByteBufferover the frame.- Parameters:
buffer- to wrap for the flyweight.
-
-
Method Details
-
version
public short version()The version field value.- Returns:
- version field value.
-
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
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
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
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
Append header flags to anAppendableto be human-readable.- Parameters:
flags- to be converted.appendable- to append flags to.
-