com.crankuptheamps.client
Class FIXBuilder

java.lang.Object
  extended by com.crankuptheamps.client.FIXBuilder

public class FIXBuilder
extends Object


Constructor Summary
FIXBuilder(int capacity, byte fieldSeparator)
           
 
Method Summary
 FIXBuilder append(int tag, byte[] value, int offset, int length)
          Appends a tag and and value pair contained within a byte buffer to the FIX message.
 FIXBuilder append(int tag, String value)
          Appends a tag and value pair to the FIX message.
 void clear()
          Clears self.
 byte[] getBytes()
          Returns the byte array containing the FIX message.
 int getSize()
          Returns the number of bytes in the byte array containing the FIX message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FIXBuilder

public FIXBuilder(int capacity,
                  byte fieldSeparator)
Method Detail

clear

public void clear()
Clears self.


getSize

public int getSize()
Returns the number of bytes in the byte array containing the FIX message.

Returns:
number of valid bytes in the byte array

getBytes

public byte[] getBytes()
Returns the byte array containing the FIX message. The number of valid bytes within the buffer is returned from getSize().

Returns:
byte array containing the FIX message

append

public FIXBuilder append(int tag,
                         byte[] value,
                         int offset,
                         int length)
                  throws CommandException
Appends a tag and and value pair contained within a byte buffer to the FIX message.

Parameters:
tag - the integer FIX tag to append
value - the byte buffer containing the FIX value to append.
offset - the starting location of the value inside the byte buffer.
length - the length of the value inside the byte buffer.
Returns:
a reference to this object.
Throws:
IllegalArgumentException - if the tag argument is negative.
CommandException

append

public FIXBuilder append(int tag,
                         String value)
                  throws CommandException
Appends a tag and value pair to the FIX message.

Parameters:
tag - the integer FIX tag to append
value - the FIX value for the tag to append. The value will be converted to an ISO-8859-1 byte array for writing.
Returns:
a reference to this object.
Throws:
IllegalArgumentException - if the tag argument is negative.
CommandException - if the tag or value argument is not convertible to ISO-8859-1