public class PackedDecimalAsBigIntegerField extends java.lang.Object implements BigIntegerAccessor
Field
up to 31 digits with BigInteger
accessors.
Constructor and Description |
---|
PackedDecimalAsBigIntegerField(int offset,
int precision,
int scale,
boolean signed)
Construct an instance
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.math.BigInteger a,
java.math.BigInteger b)
Compare two BigInteger instances, possibly null, for equality.
|
java.math.BigInteger |
getBigInteger(byte[] buffer)
Answer a BigInteger value from the given byte array buffer,
at the offset of this field.
|
java.math.BigInteger |
getBigInteger(byte[] buffer,
int bufOffset)
Answer a BigInteger value from the given byte array buffer,
at the bufOffset + offset of this field.
|
int |
getByteLength()
Answer the length of the field described by the receiver
|
int |
getOffset()
Answer the offset of this field into some array of bytes
|
int |
getPrecision()
Answer the number of decimal digits of precision.
|
int |
getScale() |
boolean |
isSigned() |
void |
putBigInteger(java.math.BigInteger value,
byte[] buffer)
Put a BigInteger value into the given byte array buffer,
at the offset of this field.
|
void |
putBigInteger(java.math.BigInteger value,
byte[] buffer,
int bufOffset)
Put a BigInteger value into the given byte array buffer,
at the bufOffset + offset of this field.
|
void |
setOffset(int offset) |
public PackedDecimalAsBigIntegerField(int offset, int precision, int scale, boolean signed)
offset
- position of this fieldprecision
- total number of digits <= 31. If even, this value is rounded up to the next odd number.scale
- zero or a negative number indicating implied
extra digits in the whole number portion of the
fieldsigned
- if true the last nibble is a signpublic int getByteLength()
getByteLength
in interface Field
public int getOffset()
public void setOffset(int offset)
setOffset
in interface Field
getOffset()
public int getPrecision()
public java.math.BigInteger getBigInteger(byte[] buffer) throws java.lang.IllegalArgumentException
getBigInteger
in interface BigIntegerAccessor
buffer
- the byte arrayjava.lang.IllegalArgumentException
- if the field contains an invalid signpublic java.math.BigInteger getBigInteger(byte[] buffer, int bufOffset) throws java.lang.IllegalArgumentException
getBigInteger
in interface BigIntegerAccessor
buffer
- the byte arraybufOffset
- the additional offset into the byte arrayjava.lang.IllegalArgumentException
- if the field contains an invalid signpublic void putBigInteger(java.math.BigInteger value, byte[] buffer) throws java.lang.IllegalArgumentException
putBigInteger
in interface BigIntegerAccessor
value
- the BigInteger valuebuffer
- the byte arrayjava.lang.IllegalArgumentException
- if the value is out of rangepublic void putBigInteger(java.math.BigInteger value, byte[] buffer, int bufOffset) throws java.lang.IllegalArgumentException
putBigInteger
in interface BigIntegerAccessor
value
- the BigInteger valuebuffer
- the byte arraybufOffset
- the additional offset into the byte arrayjava.lang.IllegalArgumentException
- if the value is out of rangepublic boolean equals(java.math.BigInteger a, java.math.BigInteger b)
a
- BigIntegerb
- BigIntegerpublic int getScale()
public boolean isSigned()