public class PackedDecimalAsLongField extends java.lang.Object implements LongAccessor
Field up to 18 digits (10 bytes) with long accessors.
| Constructor and Description |
|---|
PackedDecimalAsLongField(int offset,
int precision,
boolean signed)
Construct an instance
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Long aLong,
long along)
Compare a Long, possibly null, with a long for equality.
|
int |
getByteLength()
Answer the length of the field described by the receiver
|
long |
getLong(byte[] buffer)
Answer a long value from the given byte array buffer,
at the offset of this field.
|
long |
getLong(byte[] buffer,
int bufOffset)
Answer a long value from the given byte array buffer,
at the bufOffset + offset of this field.
|
int |
getOffset()
Answer the offset of this field into some array of bytes
|
int |
getPrecision()
Answer the number of decimal digits of precision.
|
boolean |
isSigned()
Answer whether the field is signed
|
void |
putLong(long value,
byte[] buffer)
Put a long value into the given byte array buffer,
at the offset of this field.
|
void |
putLong(long value,
byte[] buffer,
int bufOffset)
Put a long value into the given byte array buffer,
at the bufOffset + offset of this field.
|
void |
setOffset(int offset) |
public PackedDecimalAsLongField(int offset,
int precision,
boolean signed)
offset - position of this fieldprecision - total number of digits <= 18. If even, this value is rounded up to the next odd number.signed - if true the last nibble is a signpublic int getByteLength()
getByteLength in interface Fieldpublic int getOffset()
public void setOffset(int offset)
setOffset in interface FieldgetOffset()public int getPrecision()
public long getLong(byte[] buffer)
throws java.lang.IllegalArgumentException
getLong in interface LongAccessorbuffer - the byte arrayjava.lang.IllegalArgumentException - if the field contains an invalid signpublic long getLong(byte[] buffer,
int bufOffset)
getLong in interface LongAccessorbuffer - the byte arraybufOffset - the additional offset into the byte arrayjava.lang.IllegalArgumentException - if the field contains an invalid signpublic void putLong(long value,
byte[] buffer)
throws java.lang.IllegalArgumentException
putLong in interface LongAccessorvalue - the signed int valuebuffer - the byte arrayjava.lang.IllegalArgumentException - if the value is out of rangepublic void putLong(long value,
byte[] buffer,
int bufOffset)
throws java.lang.IllegalArgumentException
putLong in interface LongAccessorvalue - the signed int valuebuffer - the byte arraybufOffset - the additional offset into the byte arrayjava.lang.IllegalArgumentException - if the value is out of rangepublic boolean isSigned()
isSigned in interface LongAccessorpublic boolean equals(java.lang.Long aLong,
long along)
aLong - along -