Class RawFIXUtil

java.lang.Object
com.epam.fix.message.RawFIXUtil

public final class RawFIXUtil extends Object
Raw fix util helper class. Date: Sep 7, 2008
  • Field Details

    • DEFAULT_RAW_TAGS

      public static final DefaultRawTags DEFAULT_RAW_TAGS
    • PASSWORD_MASK

      public static final byte[] PASSWORD_MASK
  • Method Details

    • getChecksum

      public static int getChecksum(byte[] bytes)
      Calculates checksum in array of bytes.
      Parameters:
      bytes - - array of bytes
    • getChecksum

      public static int getChecksum(byte[] bytes, int offset, int length)
      Calculates checksum in array of bytes.
      Parameters:
      bytes - the array of bytes
      offset - the offset in array of bytes
      length - the length of bytes
    • getChecksum

      public static int getChecksum(byte[][] bytes, int offset, int length)
      Calculates checksum in matrix of bytes.
      Parameters:
      bytes - the array of bytes
      offset - the offset in array of bytes
      length - the length of bytes
    • getRawValue

      public static byte[] getRawValue(byte[] buffer, int offset, int length, int tag)
      Gets the value from buffer as bytes.
      Parameters:
      buffer - the buffer of bytes
      offset - the offset in buffer
      length - the buffer length
      tag - the tag id
    • getRawValue

      public static byte[] getRawValue(byte[] buffer, int offset, int length, int tag, boolean searchFromStart)
      Gets the value from buffer as bytes.
      Parameters:
      buffer - the buffer of bytes
      offset - the offset in buffer
      length - the buffer length
      tag - the tag id
      searchFromStart - search from start or end of the given buffer
    • getAllRawValues

      public static List<byte[]> getAllRawValues(byte[] buffer, int offset, int length, int tag)
      Gets the value from buffer as bytes.
      Parameters:
      buffer - the buffer of bytes
      offset - the offset in buffer
      length - the buffer length
      tag - the tag id
    • getStartValueFromEndBuffer

      public static int getStartValueFromEndBuffer(byte[] buffer, int offset, int length, int tagId)
    • getStartValueFromStartBuffer

      public static int getStartValueFromStartBuffer(byte[] buffer, int offset, int length, int tagId)
    • getLongValue

      public static long getLongValue(byte[] buffer, int offset, int length, int tag)
      Gets the value from buffer as long.
      Parameters:
      buffer - the buffer of bytes
      offset - the offset in buffer
      length - the buffer length
      tag - the tag id
      Throws:
      RuntimeException - if tag not exists
    • getLongValue

      public static long getLongValue(byte[] buffer, int offset, int length, int tag, boolean searchFromStart)
      Gets the value from buffer as long.
      Parameters:
      buffer - the buffer of bytes
      offset - the offset in buffer
      length - the buffer length
      tag - the tag id
      searchFromStart - search from the start or end buffer
      Throws:
      RuntimeException - if tag not exists
    • getSequenceNumber

      public static long getSequenceNumber(byte[] message)
      Gets sequence number.
      Parameters:
      message - the buffer of bytes
      Throws:
      RuntimeException - if tag not exists
    • getSequenceNumber

      public static long getSequenceNumber(byte[] message, int offset, int length)
      Gets sequence number.
      Parameters:
      message - the buffer of bytes
      Throws:
      RuntimeException - if tag not exists
    • getFIXFieldList

      public static FIXFieldList getFIXFieldList(byte[] buffer, int messageOffset, int messageLength)
    • getFIXFieldList

      public static FIXFieldList getFIXFieldList(MsgBuf buf)
    • getFIXFieldList

      public static FIXFieldList getFIXFieldList(MsgBuf buf, RawFIXUtil.RawTags rawTags)
    • getFIXFieldList

      public static FIXFieldList getFIXFieldList(FIXFieldList target, MsgBuf buf, RawFIXUtil.RawTags rawTags, boolean clearTheMessageBeforeUse)
    • indexRepeatingGroup

      public static FIXFieldList indexRepeatingGroup(FIXFieldList msg)
      Creates index by dictionary for repeating group. After calling this method, its possible to use Repeating Group API Version and type of message will be got from message Validation is turn off
      Parameters:
      msg - message for indexing
      Returns:
      the passed message
    • getMsgType

      public static String getMsgType(IndexedStorage msg)
    • indexRepeatingGroup

      public static FIXFieldList indexRepeatingGroup(FIXFieldList msg, boolean validation)
      Creates index by dictionary for repeating group. After calling this method, its possible to use Repeating Group API Version and type of message will be got from message
      Parameters:
      msg - message for indexing
      validation - turn on/off validation
      Returns:
      the passed message
    • indexRepeatingGroup

      public static FIXFieldList indexRepeatingGroup(FIXFieldList msg, FIXVersion version, String msgType)
      Creates index by dictionary for repeating group. After calling this method, its possible to use Repeating Group API Validation is turn off
      Parameters:
      msg - message for indexing
      version - version for passed message. Used for choose dictionary for indexing message
      msgType - type of passed message. Used for indexing message.
      Returns:
      the passed message
    • indexRepeatingGroup

      public static FIXFieldList indexRepeatingGroup(FIXFieldList msg, com.epam.fixengine.configuration.FIXVersionContainer version, String msgType)
    • indexRepeatingGroup

      public static FIXFieldList indexRepeatingGroup(FIXFieldList msg, FIXVersion version, String msgType, boolean validation)
      Creates index by dictionary for repeating group. After calling this method, its possible to use Repeating Group API
      Parameters:
      msg - message for indexing
      version - version for passed message. Used for choose dictionary for indexing message
      msgType - type of passed message. Used for indexing message.
      validation - turn on/off validation
      Returns:
      the passed message
    • indexRepeatingGroup

      public static FIXFieldList indexRepeatingGroup(FIXFieldList msg, com.epam.fixengine.configuration.FIXVersionContainer version, String msgType, boolean validation)
    • indexRepeatingGroup

      public static FIXFieldList indexRepeatingGroup(FIXFieldList msg, FIXVersion version, boolean validation)
    • indexRepeatingGroup

      public static FIXFieldList indexRepeatingGroup(FIXFieldList msg, com.epam.fixengine.configuration.FIXVersionContainer version, boolean validation)
    • getFIXFieldList

      public static FIXFieldList getFIXFieldList(String message)
    • getFIXFieldList

      public static FIXFieldList getFIXFieldList(byte[] message)
      Parses fix message from array of bytes.
      Parameters:
      message - the buffer of bytes
      Throws:
      GarbledMessageException - - if message is garbled
    • getFIXFieldList

      public static FIXFieldList getFIXFieldList(byte[] message, boolean usePool, boolean isUserOwned)
    • getFIXFieldListUtilTagsExists

      public static FIXFieldList getFIXFieldListUtilTagsExists(byte[] message)
      Parses fix message from array of bytes.
      Parameters:
      message - the buffer of bytes
      Throws:
      GarbledMessageException - - if message is garbled
    • getFIXFieldList

      public static FIXFieldList getFIXFieldList(byte[] message, int[] rawTags)
      Parses fix message from array of bytes.
      Parameters:
      message - the buffer of bytes
      rawTags - the raw tags
      Throws:
      GarbledMessageException - - if message is garbled
    • getFIXFieldList

      public static FIXFieldList getFIXFieldList(byte[] message, RawFIXUtil.RawTags rawTags)
    • getFIXFieldList

      public static FIXFieldList getFIXFieldList(byte[] message, int messageOffset, int messageLength, int[] rawTags)
      Parses fix message from array of bytes.
      Parameters:
      message - the buffer of bytes
      rawTags - the raw tags
      Throws:
      GarbledMessageException - - if message is garbled
    • getFIXFieldList

      public static FIXFieldList getFIXFieldList(byte[] message, int messageOffset, int messageLength, RawFIXUtil.RawTags rawTags)
    • getFIXFieldList

      public static FIXFieldList getFIXFieldList(byte[] message, int messageOffset, int messageLength, RawFIXUtil.RawTags rawTags, boolean allocateFromPool, boolean isUserOwned)
      Parses fix message from array of bytes.
      Parameters:
      message - the buffer of bytes
      rawTags - the raw tags
      Returns:
      instance of parsed message
      Throws:
      GarbledMessageException - - if message is garbled
    • getFIXFieldList

      public static FIXFieldList getFIXFieldList(FIXFieldList list, byte[] message, int messageOffset, int messageLength, RawFIXUtil.RawTags rawTags)
    • getFIXFieldList

      public static FIXFieldList getFIXFieldList(FIXFieldList list, byte[] message, int messageOffset, int messageLength, RawFIXUtil.RawTags rawTags, boolean clearTheMessageBeforeUse)
    • getFIXFieldListUntilTagsExists

      public static FIXFieldList getFIXFieldListUntilTagsExists(byte[] message, int messageOffset, int messageLength, RawFIXUtil.RawTags rawTags)
      Parses fix message from array of bytes.
      Parameters:
      message - the buffer of bytes
      rawTags - the raw tags
      Returns:
      instance of parsed message
      Throws:
      GarbledMessageException - - if message is garbled
    • returnObj

      public static void returnObj(FIXField field)
    • returnObj

      public static void returnObj(FIXFieldList fieldList)
    • fieldObjectsCreated

      public static int fieldObjectsCreated()
    • fieldListObjectsCreated

      public static int fieldListObjectsCreated()
    • copyValueUsePool

      public static byte[] copyValueUsePool(byte[] message, int valueStartIndex, int length)
    • copyValue

      public static byte[] copyValue(byte[] message, int valueStartIndex, int length)
    • getRawTagLengthFromPreviousField

      public static int getRawTagLengthFromPreviousField(FIXFieldList list)
    • isWithinRawTags

      @Deprecated public static boolean isWithinRawTags(int[] rawTags, int tag)
      Deprecated.
      use RawFIXUtil.createRawTags() instead
      Checks if tag exist in array of tags.
      Parameters:
      rawTags - the array of tags
      tag - the tag id
      Returns:
      true if exists
    • getMessageType

      public static byte[] getMessageType(byte[] bytes)
      Gets the message type. If type is unknown return empty array.
      Parameters:
      bytes - the message
    • getMessageType

      public static byte[] getMessageType(byte[] bytes, int offset, int length)
      Gets the message type. If type is unknown return empty array.
      Parameters:
      bytes - the message
    • isSessionLevelMessage

      public static boolean isSessionLevelMessage(byte[] message, int offset, int length)
      Checks the message session level type.
      Parameters:
      message - the fix message
      Returns:
      true if message is level session message
    • isMessageType

      public static boolean isMessageType(byte[] buffer, int offset, int length, byte[] msgType)
    • isMessageType

      public static boolean isMessageType(byte[] buffer, int offset, int length, byte[][] msgTypes)
    • isTagValueEquals

      public static boolean isTagValueEquals(byte[] buffer, int offset, int length, byte[] expectedValue, int tag, boolean searchFromStart)
    • isTagValueEquals

      public static boolean isTagValueEquals(byte[] buffer, int offset, int length, byte[][] expectedValues, int tag, boolean searchFromStart)
    • isSessionLevelMessage

      public static boolean isSessionLevelMessage(byte[] message)
      Checks the message session level type.
      Parameters:
      message - the fix message
      Returns:
      true if message is level session message
    • isSessionLevelMessage

      public static boolean isSessionLevelMessage(FIXFieldList message)
    • isSessionLevelType

      public static boolean isSessionLevelType(String msgType)
      Checks the message session level type.
      Parameters:
      msgType - the message type
      Returns:
      true if message is level session message
    • isSessionLevelType

      public static boolean isSessionLevelType(byte[] msgType)
      Checks the message session level type.
      Parameters:
      msgType - the fix message
      Returns:
      true if message is level session message
    • isSessionLevelType

      public static boolean isSessionLevelType(byte[] msgType, int length)
    • isSessionLevelType

      public static boolean isSessionLevelType(byte msgType, int length)
    • isLogon

      public static boolean isLogon(String msgType)
      Checks if message type is Logon.
      Parameters:
      msgType - the message type, parameter must be not null
      Returns:
      true if is
    • isLogon

      public static boolean isLogon(byte[] msgType)
      Checks if message type is Logon.
      Parameters:
      msgType - the message type, parameter must be not null
      Returns:
      true if is
    • isLogon

      public static boolean isLogon(byte[] msgType, int length)
    • isLogon

      public static boolean isLogon(FIXFieldList fixFieldList)
      Checks if message type is Logon.
      Parameters:
      fixFieldList - fix field list, parameter must be not null
      Returns:
      true if is
    • createRawTags

      public static RawFIXUtil.RawTags createRawTags(int[] rawTags)
      Creates RawTags from array of int.
      Parameters:
      rawTags -
      Returns:
      RawTags
    • createRawTags

      public static RawFIXUtil.RawTags createRawTags(String rawTags)
      Creates RawTags from string. The raw tags should be separate by ',' , ' ' or '.'.
      Parameters:
      rawTags -
      Returns:
      RawTags
    • countTagValueLength

      public static int countTagValueLength(byte[] buffer, int seqStart)
    • findValueStartMaskTag

      public static int findValueStartMaskTag(byte[] message, int offset, int length, Set<Integer> maskTagsSet)
    • findMsgLengthWithMaskTags

      public static int findMsgLengthWithMaskTags(byte[] message, int length, Set<Integer> maskTagsSet)