Class OtfHeaderDecoder

java.lang.Object
uk.co.real_logic.sbe.otf.OtfHeaderDecoder

public class OtfHeaderDecoder extends Object
Used to decode a message header while doing on-the-fly decoding of a message stream.

Metadata is cached to improve the performance of decoding headers.

This class is thread safe.

  • Constructor Details

    • OtfHeaderDecoder

      public OtfHeaderDecoder(HeaderStructure headerStructure)
      Read the message header structure and cache the meta data for finding the key fields for decoding messages.
      Parameters:
      headerStructure - for the meta data describing the message header.
  • Method Details

    • encodedLength

      public int encodedLength()
      The encodedLength of the message header in bytes.
      Returns:
      the encodedLength of the message header in bytes.
    • getBlockLength

      public int getBlockLength(DirectBuffer buffer, int bufferOffset)
      Get the block length of the root block in the message.
      Parameters:
      buffer - from which to read the value.
      bufferOffset - in the buffer at which the message header begins.
      Returns:
      the length of the root block in the coming message.
    • getTemplateId

      public int getTemplateId(DirectBuffer buffer, int bufferOffset)
      Get the template id from the message header.
      Parameters:
      buffer - from which to read the value.
      bufferOffset - in the buffer at which the message header begins.
      Returns:
      the value of the template id.
    • getSchemaId

      public int getSchemaId(DirectBuffer buffer, int bufferOffset)
      Get the schema id number from the message header.
      Parameters:
      buffer - from which to read the value.
      bufferOffset - in the buffer at which the message header begins.
      Returns:
      the value of the schema id number.
    • getSchemaVersion

      public int getSchemaVersion(DirectBuffer buffer, int bufferOffset)
      Get the schema version number from the message header.
      Parameters:
      buffer - from which to read the value.
      bufferOffset - in the buffer at which the message header begins.
      Returns:
      the value of the schema version number.