public class NVFIXBuilder
extends java.lang.Object
// Create a string for the topic
String topic = "messages";
// Create a builder with 1024 bytes of initial capacity,
// using the default 0x01 delimiter.
NVFIXBuilder builder = new NVFIXBuilder(1024, (byte)1);
// Example publishing loop reusing the builder.
for (int i = 1; 1 <= 100; ++i) {
// Add fields for message.
builder.append(0, "" + i);
builder.append(1, "Here's another field");
builder.append(3, "1234567890");
client.publish(topic.getBytes(), 0, topic.length(),
builder.getBytes(), 0, builder.getSize());
// Reuse the builder for the next message by clearing it.
builder.clear();
Constructor and Description |
---|
NVFIXBuilder(int capacity,
byte fieldSeparator) |
Modifier and Type | Method and Description |
---|---|
NVFIXBuilder |
append(java.lang.String tag,
byte[] value,
int offset,
int length)
Appends a tag and value pair contained within a byte buffer to the FIX message.
|
NVFIXBuilder |
append(java.lang.String tag,
java.lang.String value)
Appends a tag and value pair to the FIX message.
|
void |
clear()
Clears the current builder, resetting it to empty.
|
byte[] |
getBytes()
Returns the byte array containing the NVFIX message.
|
int |
getSize()
Returns the number of bytes in the byte array containing the NVFIX message.
|
public void clear()
public int getSize()
public byte[] getBytes()
public NVFIXBuilder append(java.lang.String tag, byte[] value, int offset, int length) throws CommandException
tag
- The String NVFIX tag to appendvalue
- 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.CommandException
- If the tag or value argument is not convertible to ISO-8859-1.public NVFIXBuilder append(java.lang.String tag, java.lang.String value) throws CommandException
tag
- The string FIX tag to appendvalue
- The FIX value for the tag to append. The value will be converted
to an ISO-8859-1 byte array for writing.CommandException
- If the tag or value argument is not convertible to ISO-8859-1.