Class OtfMessageDecoder

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

public class OtfMessageDecoder extends Object
On-the-fly decoder that dynamically decodes messages based on the IR for a schema.

The contents of the messages are structurally decomposed and passed to a TokenListener for decoding the primitive values.

The design keeps all state on the stack to maximise performance and avoid object allocation. The message decoder can be reused repeatably by calling decode(DirectBuffer, int, int, int, List, TokenListener) which is thread safe to be used across multiple threads.

  • Constructor Details

    • OtfMessageDecoder

      public OtfMessageDecoder()
  • Method Details

    • decode

      public static int decode(DirectBuffer buffer, int offset, int actingVersion, int blockLength, List<Token> msgTokens, TokenListener listener)
      Decode a message from the provided buffer based on the message schema described with IR Tokens.
      Parameters:
      buffer - containing the encoded message.
      offset - at which the message encoding starts in the buffer.
      actingVersion - of the encoded message for dealing with extension fields.
      blockLength - of the root message fields.
      msgTokens - in IR format describing the message structure.
      listener - to callback for decoding the primitive values as discovered in the structure.
      Returns:
      the index in the underlying buffer after decoding.