public class FIXValue extends Object
Constructor and Description |
---|
FIXValue(int capacity)
Construct a new value container.
|
Modifier and Type | Method and Description |
---|---|
boolean |
asBoolean()
Get the value as a boolean.
|
char |
asChar()
Get the value as a character.
|
long |
asCheckSum()
Deprecated.
Use
asInt() instead. |
void |
asDate(MutableDateTime x)
Get the value as a date.
|
double |
asFloat()
Get the value as a float.
|
long |
asInt()
Get the value as an integer.
|
String |
asString()
Get the value as a string.
|
void |
asString(Appendable x)
Get the value as a string.
|
void |
asString(StringBuilder x)
Get the value as a string.
|
void |
asTimeOnly(MutableDateTime x)
Get the value as a time only.
|
void |
asTimestamp(MutableDateTime x)
Get the value as a timestamp.
|
byte |
byteAt(int index)
Get the byte at the specified index.
|
boolean |
contentEquals(byte x)
Compare the string representation of this value to the specified
character.
|
boolean |
contentEquals(byte[] x)
Compare the string representation of this value to the specified
character sequence.
|
boolean |
contentEquals(char x)
Compare the string representation of this value to the specified
character.
|
boolean |
contentEquals(CharSequence x)
Compare the string representation of this value to the specified
character sequence.
|
void |
copyTo(byte[] dst)
Copy the value to a destination byte array.
|
boolean |
get(ByteBuffer buffer)
Read this value from a buffer.
|
int |
length()
Get the length of the value.
|
void |
put(ByteBuffer buffer)
Write this value to a buffer.
|
void |
reset()
Reset the value.
|
void |
set(FIXValue value)
Set the value.
|
void |
setBoolean(boolean x)
Set the value to a boolean.
|
void |
setChar(char x)
Set the value to a character.
|
void |
setCheckSum(long x)
Set the value to a checksum.
|
void |
setDate(ReadableDateTime x)
Set the value to a date.
|
void |
setFloat(double x,
int decimals)
Set the value to a float.
|
void |
setInt(long x)
Set the value to an integer.
|
void |
setString(CharSequence x)
Set the value to a string.
|
void |
setTimeOnly(ReadableDateTime x,
boolean millis)
Set the value to a time only.
|
void |
setTimestamp(ReadableDateTime x,
boolean millis)
Set the value to a timestamp.
|
String |
toString()
Returns a string representation of this value.
|
public FIXValue(int capacity)
capacity
- the capacitypublic byte byteAt(int index)
index
- the indexIndexOutOfBoundsException
- if the index is outside of this
value containerpublic int length()
public boolean contentEquals(byte x)
x
- the character to compare the string representation of this
value againstpublic boolean contentEquals(byte[] x)
x
- the character sequence to compare the string representation of
this value againstpublic boolean contentEquals(char x)
x
- the character to compare the string representation of this
value againstpublic boolean contentEquals(CharSequence x)
x
- the character sequence to compare the string representation of
this value againstpublic void copyTo(byte[] dst)
dst
- a destination byte arrayIndexOutOfBoundsException
- if the length of the value is greater
than the length of the destination byte arraypublic void reset()
public void set(FIXValue value)
value
- a value containerpublic boolean asBoolean()
FIXValueFormatException
- if the value is not a booleanpublic void setBoolean(boolean x)
x
- a booleanpublic char asChar()
FIXValueFormatException
- if the value is not a characterpublic void setChar(char x)
x
- a characterpublic long asInt()
FIXValueFormatException
- if the value is not an integerpublic void setInt(long x)
x
- an integerpublic double asFloat()
Note. The value is a string representation of a decimal number. As converting an arbitrary decimal number into a floating point number requires arbitrary-precision arithmetic, this method only works with the subset of decimal numbers that can be converted into floating point numbers using floating-point arithmetic.
If we represent a decimal number in the form ±s × 10e, where s is an integer significand and e is an integer exponent, this method works for decimal numbers having 0 ≤ s ≤ 253 - 1 and -17 ≤ e ≤ 2.
FIXValueFormatException
- if the value is not a floatpublic void setFloat(double x, int decimals)
x
- a floatdecimals
- the number of decimalsasFloat()
public String asString()
public void asString(Appendable x) throws IOException
x
- an appendableIOException
- if an I/O error occurspublic void asString(StringBuilder x)
x
- a string builderpublic void setString(CharSequence x)
x
- a stringIndexOutOfBoundsException
- if the string is too longpublic void asDate(MutableDateTime x)
Note. This method sets both date and time fields.
When combining this method and asTimeOnly(MutableDateTime)
,
this method should be invoked first.
x
- a dateFIXValueFormatException
- if the value is not a dateasTimeOnly(MutableDateTime)
public void setDate(ReadableDateTime x)
x
- a datepublic void asTimeOnly(MutableDateTime x)
x
- a time onlyFIXValueFormatException
- if the value is not a time onlyasDate(MutableDateTime)
public void setTimeOnly(ReadableDateTime x, boolean millis)
x
- a time onlymillis
- if true set milliseconds, otherwise do not set millisecondspublic void asTimestamp(MutableDateTime x)
x
- a timestampFIXValueFormatException
- if the value is not a timestamppublic void setTimestamp(ReadableDateTime x, boolean millis)
x
- a timestampmillis
- if true set milliseconds, otherwise do not set milliseconds@Deprecated public long asCheckSum()
asInt()
instead.FIXValueFormatException
- if the value is not an integerpublic void setCheckSum(long x)
x
- a checksumpublic boolean get(ByteBuffer buffer) throws FIXValueOverflowException
buffer
- a bufferFIXValueOverflowException
- if the length of the value exceeds
the capacity of this value containerpublic void put(ByteBuffer buffer)
buffer
- a bufferBufferOverflowException
- if there are fewer bytes remaining in
the buffer than what this value consists ofReadOnlyBufferException
- if the buffer is read-onlyCopyright © 2021. All rights reserved.