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 intcountTagValueLength(byte[] buffer, int seqStart) static RawFIXUtil.RawTagscreateRawTags(int[] rawTags) Creates RawTags from array of int.static RawFIXUtil.RawTagscreateRawTags(String rawTags) Creates RawTags from string.static intstatic intstatic intfindMsgLengthWithMaskTags(byte[] message, int length, Set<Integer> maskTagsSet) static intfindValueStartMaskTag(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 intgetChecksum(byte[] bytes) Calculates checksum in array of bytes.static intgetChecksum(byte[][] bytes, int offset, int length) Calculates checksum in matrix of bytes.static intgetChecksum(byte[] bytes, int offset, int length) Calculates checksum in array of bytes.static FIXFieldListgetFIXFieldList(byte[] message) Parses fix message from array of bytes.static FIXFieldListgetFIXFieldList(byte[] message, boolean usePool, boolean isUserOwned) static FIXFieldListgetFIXFieldList(byte[] message, int[] rawTags) Parses fix message from array of bytes.static FIXFieldListgetFIXFieldList(byte[] buffer, int messageOffset, int messageLength) static FIXFieldListgetFIXFieldList(byte[] message, int messageOffset, int messageLength, int[] rawTags) Parses fix message from array of bytes.static FIXFieldListgetFIXFieldList(byte[] message, int messageOffset, int messageLength, RawFIXUtil.RawTags rawTags) static FIXFieldListgetFIXFieldList(byte[] message, int messageOffset, int messageLength, RawFIXUtil.RawTags rawTags, boolean allocateFromPool, boolean isUserOwned) Parses fix message from array of bytes.static FIXFieldListgetFIXFieldList(byte[] message, RawFIXUtil.RawTags rawTags) static FIXFieldListgetFIXFieldList(FIXFieldList list, byte[] message, int messageOffset, int messageLength, RawFIXUtil.RawTags rawTags) static FIXFieldListgetFIXFieldList(FIXFieldList list, byte[] message, int messageOffset, int messageLength, RawFIXUtil.RawTags rawTags, boolean clearTheMessageBeforeUse) static FIXFieldListgetFIXFieldList(FIXFieldList target, MsgBuf buf, RawFIXUtil.RawTags rawTags, boolean clearTheMessageBeforeUse) static FIXFieldListgetFIXFieldList(MsgBuf buf) static FIXFieldListgetFIXFieldList(MsgBuf buf, RawFIXUtil.RawTags rawTags) static FIXFieldListgetFIXFieldList(String message) static FIXFieldListgetFIXFieldListUntilTagsExists(byte[] message, int messageOffset, int messageLength, RawFIXUtil.RawTags rawTags) Parses fix message from array of bytes.static FIXFieldListgetFIXFieldListUtilTagsExists(byte[] message) Parses fix message from array of bytes.static longgetLongValue(byte[] buffer, int offset, int length, int tag) Gets the value from buffer as long.static longgetLongValue(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 StringgetMsgType(IndexedStorage msg) static intstatic 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 longgetSequenceNumber(byte[] message) Gets sequence number.static longgetSequenceNumber(byte[] message, int offset, int length) Gets sequence number.static intgetStartValueFromEndBuffer(byte[] buffer, int offset, int length, int tagId) static intgetStartValueFromStartBuffer(byte[] buffer, int offset, int length, int tagId) static FIXFieldListCreates index by dictionary for repeating group.static FIXFieldListindexRepeatingGroup(FIXFieldList msg, boolean validation) Creates index by dictionary for repeating group.static FIXFieldListindexRepeatingGroup(FIXFieldList msg, FIXVersion version, boolean validation) static FIXFieldListindexRepeatingGroup(FIXFieldList msg, FIXVersion version, String msgType) Creates index by dictionary for repeating group.static FIXFieldListindexRepeatingGroup(FIXFieldList msg, FIXVersion version, String msgType, boolean validation) Creates index by dictionary for repeating group.static FIXFieldListindexRepeatingGroup(FIXFieldList msg, com.epam.fixengine.configuration.FIXVersionContainer version, boolean validation) static FIXFieldListindexRepeatingGroup(FIXFieldList msg, com.epam.fixengine.configuration.FIXVersionContainer version, String msgType) static FIXFieldListindexRepeatingGroup(FIXFieldList msg, com.epam.fixengine.configuration.FIXVersionContainer version, String msgType, boolean validation) static booleanisLogon(byte[] msgType) Checks if message type is Logon.static booleanisLogon(byte[] msgType, int length) static booleanisLogon(FIXFieldList fixFieldList) Checks if message type is Logon.static booleanChecks if message type is Logon.static booleanisMessageType(byte[] buffer, int offset, int length, byte[] msgType) static booleanisMessageType(byte[] buffer, int offset, int length, byte[][] msgTypes) static booleanisSessionLevelMessage(byte[] message) Checks the message session level type.static booleanisSessionLevelMessage(byte[] message, int offset, int length) Checks the message session level type.static booleanisSessionLevelMessage(FIXFieldList message) static booleanisSessionLevelType(byte[] msgType) Checks the message session level type.static booleanisSessionLevelType(byte[] msgType, int length) static booleanisSessionLevelType(byte msgType, int length) static booleanisSessionLevelType(String msgType) Checks the message session level type.static booleanisTagValueEquals(byte[] buffer, int offset, int length, byte[][] expectedValues, int tag, boolean searchFromStart) static booleanisTagValueEquals(byte[] buffer, int offset, int length, byte[] expectedValue, int tag, boolean searchFromStart) static booleanisWithinRawTags(int[] rawTags, int tag) Deprecated.use RawFIXUtil.createRawTags() insteadstatic voidstatic voidreturnObj(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
-