Package com.epam.fix.message
Class RawFIXUtil
java.lang.Object
com.epam.fix.message.RawFIXUtil
Raw fix util helper class.
Date: Sep 7, 2008
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
copyValue
(byte[] message, int valueStartIndex, int length) static byte[]
copyValueUsePool
(byte[] message, int valueStartIndex, int length) static int
countTagValueLength
(byte[] buffer, int seqStart) static RawFIXUtil.RawTags
createRawTags
(int[] rawTags) Creates RawTags from array of int.static RawFIXUtil.RawTags
createRawTags
(String rawTags) Creates RawTags from string.static int
static int
static int
findMsgLengthWithMaskTags
(byte[] message, int length, Set<Integer> maskTagsSet) static int
findValueStartMaskTag
(byte[] message, int offset, int length, Set<Integer> maskTagsSet) static List<byte[]>
getAllRawValues
(byte[] buffer, int offset, int length, int tag) Gets the value from buffer as bytes.static int
getChecksum
(byte[] bytes) Calculates checksum in array of bytes.static int
getChecksum
(byte[][] bytes, int offset, int length) Calculates checksum in matrix of bytes.static int
getChecksum
(byte[] bytes, int offset, int length) Calculates checksum in array of bytes.static FIXFieldList
getFIXFieldList
(byte[] message) Parses fix message from array of bytes.static FIXFieldList
getFIXFieldList
(byte[] message, boolean usePool, boolean isUserOwned) static FIXFieldList
getFIXFieldList
(byte[] message, int[] rawTags) Parses fix message from array of bytes.static FIXFieldList
getFIXFieldList
(byte[] buffer, int messageOffset, int messageLength) static FIXFieldList
getFIXFieldList
(byte[] message, int messageOffset, int messageLength, int[] rawTags) Parses fix message from array of bytes.static FIXFieldList
getFIXFieldList
(byte[] message, int messageOffset, int messageLength, RawFIXUtil.RawTags rawTags) static FIXFieldList
getFIXFieldList
(byte[] message, int messageOffset, int messageLength, RawFIXUtil.RawTags rawTags, boolean allocateFromPool, boolean isUserOwned) Parses fix message from array of bytes.static FIXFieldList
getFIXFieldList
(byte[] message, RawFIXUtil.RawTags rawTags) static FIXFieldList
getFIXFieldList
(FIXFieldList list, byte[] message, int messageOffset, int messageLength, RawFIXUtil.RawTags rawTags) static FIXFieldList
getFIXFieldList
(FIXFieldList list, byte[] message, int messageOffset, int messageLength, RawFIXUtil.RawTags rawTags, boolean clearTheMessageBeforeUse) static FIXFieldList
getFIXFieldList
(FIXFieldList target, MsgBuf buf, RawFIXUtil.RawTags rawTags, boolean clearTheMessageBeforeUse) static FIXFieldList
getFIXFieldList
(MsgBuf buf) static FIXFieldList
getFIXFieldList
(MsgBuf buf, RawFIXUtil.RawTags rawTags) static FIXFieldList
getFIXFieldList
(String message) static FIXFieldList
getFIXFieldListUntilTagsExists
(byte[] message, int messageOffset, int messageLength, RawFIXUtil.RawTags rawTags) Parses fix message from array of bytes.static FIXFieldList
getFIXFieldListUtilTagsExists
(byte[] message) Parses fix message from array of bytes.static long
getLongValue
(byte[] buffer, int offset, int length, int tag) Gets the value from buffer as long.static long
getLongValue
(byte[] buffer, int offset, int length, int tag, boolean searchFromStart) Gets the value from buffer as long.static byte[]
getMessageType
(byte[] bytes) Gets the message type.static byte[]
getMessageType
(byte[] bytes, int offset, int length) Gets the message type.static String
getMsgType
(IndexedStorage msg) static int
static byte[]
getRawValue
(byte[] buffer, int offset, int length, int tag) Gets the value from buffer as bytes.static byte[]
getRawValue
(byte[] buffer, int offset, int length, int tag, boolean searchFromStart) Gets the value from buffer as bytes.static long
getSequenceNumber
(byte[] message) Gets sequence number.static long
getSequenceNumber
(byte[] message, int offset, int length) Gets sequence number.static int
getStartValueFromEndBuffer
(byte[] buffer, int offset, int length, int tagId) static int
getStartValueFromStartBuffer
(byte[] buffer, int offset, int length, int tagId) static FIXFieldList
Creates index by dictionary for repeating group.static FIXFieldList
indexRepeatingGroup
(FIXFieldList msg, boolean validation) Creates index by dictionary for repeating group.static FIXFieldList
indexRepeatingGroup
(FIXFieldList msg, FIXVersion version, boolean validation) static FIXFieldList
indexRepeatingGroup
(FIXFieldList msg, FIXVersion version, String msgType) Creates index by dictionary for repeating group.static FIXFieldList
indexRepeatingGroup
(FIXFieldList msg, FIXVersion version, String msgType, boolean validation) Creates index by dictionary for repeating group.static FIXFieldList
indexRepeatingGroup
(FIXFieldList msg, com.epam.fixengine.configuration.FIXVersionContainer version, boolean validation) static FIXFieldList
indexRepeatingGroup
(FIXFieldList msg, com.epam.fixengine.configuration.FIXVersionContainer version, String msgType) static FIXFieldList
indexRepeatingGroup
(FIXFieldList msg, com.epam.fixengine.configuration.FIXVersionContainer version, String msgType, boolean validation) static boolean
isLogon
(byte[] msgType) Checks if message type is Logon.static boolean
isLogon
(byte[] msgType, int length) static boolean
isLogon
(FIXFieldList fixFieldList) Checks if message type is Logon.static boolean
Checks if message type is Logon.static boolean
isMessageType
(byte[] buffer, int offset, int length, byte[] msgType) static boolean
isMessageType
(byte[] buffer, int offset, int length, byte[][] msgTypes) static boolean
isSessionLevelMessage
(byte[] message) Checks the message session level type.static boolean
isSessionLevelMessage
(byte[] message, int offset, int length) Checks the message session level type.static boolean
isSessionLevelMessage
(FIXFieldList message) static boolean
isSessionLevelType
(byte[] msgType) Checks the message session level type.static boolean
isSessionLevelType
(byte[] msgType, int length) static boolean
isSessionLevelType
(byte msgType, int length) static boolean
isSessionLevelType
(String msgType) Checks the message session level type.static boolean
isTagValueEquals
(byte[] buffer, int offset, int length, byte[][] expectedValues, int tag, boolean searchFromStart) static boolean
isTagValueEquals
(byte[] buffer, int offset, int length, byte[] expectedValue, int tag, boolean searchFromStart) static boolean
isWithinRawTags
(int[] rawTags, int tag) Deprecated.use RawFIXUtil.createRawTags() insteadstatic void
static void
returnObj
(FIXFieldList fieldList)
-
Field Details
-
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 bytesoffset
- the offset in array of byteslength
- 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 bytesoffset
- the offset in array of byteslength
- 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 bytesoffset
- the offset in bufferlength
- the buffer lengthtag
- 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 bytesoffset
- the offset in bufferlength
- the buffer lengthtag
- the tag idsearchFromStart
- search from start or end of the given buffer
-
getAllRawValues
Gets the value from buffer as bytes.- Parameters:
buffer
- the buffer of bytesoffset
- the offset in bufferlength
- the buffer lengthtag
- 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 bytesoffset
- the offset in bufferlength
- the buffer lengthtag
- 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 bytesoffset
- the offset in bufferlength
- the buffer lengthtag
- the tag idsearchFromStart
- 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
-
getFIXFieldList
-
getFIXFieldList
-
getFIXFieldList
public static FIXFieldList getFIXFieldList(FIXFieldList target, MsgBuf buf, RawFIXUtil.RawTags rawTags, boolean clearTheMessageBeforeUse) -
indexRepeatingGroup
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
-
indexRepeatingGroup
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 indexingvalidation
- 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 indexingversion
- version for passed message. Used for choose dictionary for indexing messagemsgType
- 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 indexingversion
- version for passed message. Used for choose dictionary for indexing messagemsgType
- 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
-
getFIXFieldList
Parses fix message from array of bytes.- Parameters:
message
- the buffer of bytes- Throws:
GarbledMessageException
- - if message is garbled
-
getFIXFieldList
-
getFIXFieldListUtilTagsExists
Parses fix message from array of bytes.- Parameters:
message
- the buffer of bytes- Throws:
GarbledMessageException
- - if message is garbled
-
getFIXFieldList
Parses fix message from array of bytes.- Parameters:
message
- the buffer of bytesrawTags
- the raw tags- Throws:
GarbledMessageException
- - if message is garbled
-
getFIXFieldList
-
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 bytesrawTags
- 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 bytesrawTags
- 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 bytesrawTags
- the raw tags- Returns:
- instance of parsed message
- Throws:
GarbledMessageException
- - if message is garbled
-
returnObj
-
returnObj
-
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
-
isWithinRawTags
Deprecated.use RawFIXUtil.createRawTags() insteadChecks if tag exist in array of tags.- Parameters:
rawTags
- the array of tagstag
- 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
-
isSessionLevelType
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
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
Checks if message type is Logon.- Parameters:
fixFieldList
- fix field list, parameter must be not null- Returns:
- true if is
-
createRawTags
Creates RawTags from array of int.- Parameters:
rawTags
-- Returns:
- RawTags
-
createRawTags
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
-
findMsgLengthWithMaskTags
-