public class RecordDescriptor
extends java.lang.Object
RingBuffer
.Modifier and Type | Field and Description |
---|---|
static int |
ALIGNMENT
Alignment as a multiple of bytes for each record.
|
static int |
HEADER_LENGTH
Header length made up of fields for length, type, and then the encoded message.
|
Constructor and Description |
---|
RecordDescriptor() |
Modifier and Type | Method and Description |
---|---|
static void |
checkTypeId(int msgTypeId)
Check that and message id is in the valid range.
|
static int |
encodedMsgOffset(int recordOffset)
The offset from the beginning of a record at which the encoded message begins.
|
static int |
lengthOffset(int recordOffset)
The offset from the beginning of a record at which the message length field begins.
|
static long |
makeHeader(int length,
int msgTypeId)
Make a 64-bit header from the length and message type id.
|
static int |
messageTypeId(long header) |
static int |
recordLength(long header)
Extract the record length field from a word representing the header.
|
static int |
typeOffset(int recordOffset)
The offset from the beginning of a record at which the message type field begins.
|
public static final int HEADER_LENGTH
Writing of a positive record length signals the message recording is complete.
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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |R| Length | +-+-------------------------------------------------------------+ | Type | +---------------------------------------------------------------+ | Encoded Message ... ... | +---------------------------------------------------------------+
public static final int ALIGNMENT
public static int lengthOffset(int recordOffset)
recordOffset
- beginning index of the record.public static int typeOffset(int recordOffset)
recordOffset
- beginning index of the record.public static int encodedMsgOffset(int recordOffset)
recordOffset
- beginning index of the record.public static long makeHeader(int length, int msgTypeId)
length
- length of the recordmsgTypeId
- of the message stored in the recordpublic static int recordLength(long header)
header
- containing both fields.public static int messageTypeId(long header)
public static void checkTypeId(int msgTypeId)
msgTypeId
- to be checked.java.lang.IllegalArgumentException
- if the id is not in the valid range.Copyright © 2014-2017 Real Logic Ltd. All Rights Reserved.