com.epam.fix.message
Class RawFIXUtil

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

public final class RawFIXUtil
extends Object

Raw fix util helper class. Date: Sep 7, 2008


Nested Class Summary
static interface RawFIXUtil.RawTags
           
 
Field Summary
static DefaultRawTags DEFAULT_RAW_TAGS
           
 
Method Summary
static byte[] copyValue(byte[] message, int valueStartIndex, int length)
           
static byte[] copyValueUsePool(byte[] message, int valueStartIndex, int length)
           
static RawFIXUtil.RawTags createRawTags(int[] rawTags)
          Creates RawTags from array of int.
static RawFIXUtil.RawTags createRawTags(String rawTags)
          Creates RawTags from string.
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 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 int getRawTagLengthFromPreviousField(FIXFieldList list)
           
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 boolean isLogon(byte[] msgType)
          Checks if message type is Logon.
static boolean isLogon(String msgType)
          Checks if message type is Logon.
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(String msgType)
          Checks the message session level type.
static boolean isWithinRawTags(int[] rawTags, int tag)
          Deprecated. use RawFIXUtil.createRawTags() instead
static void returnObj(FIXField field)
           
static void returnObj(FIXFieldList fieldList)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_RAW_TAGS

public static final DefaultRawTags DEFAULT_RAW_TAGS
Method Detail

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

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)

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)

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

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)

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

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


Copyright © 2000-2014 EPAM Systems. All Rights Reserved.