public class PackedDecimalAsBigDecimalField extends java.lang.Object implements BigDecimalAccessor
Field
with BigDecimal
accessors.
A "scale" determines the implied number of digits to the right of the decimal point.
Constructor and Description |
---|
PackedDecimalAsBigDecimalField(int offset,
int precision,
int scale,
boolean signed)
Construct an instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.math.BigDecimal a,
java.math.BigDecimal b)
Compare two BigDecimal instances, possibly null, for equality.
|
java.math.BigDecimal |
getBigDecimal(byte[] buffer)
Answer a BigDecimal from the given byte array buffer,
at the offset of this field.
|
java.math.BigDecimal |
getBigDecimal(byte[] buffer,
int bufOffset)
Answer a BigDecimal 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() |
int |
getScale() |
boolean |
isSigned()
Answer true if the field is signed.
|
void |
putBigDecimal(java.math.BigDecimal value,
byte[] buffer)
Put a BigDecimal into the given byte array buffer,
at the offset of this field.
|
void |
putBigDecimal(java.math.BigDecimal value,
byte[] buffer,
int bufOffset)
Put a BigDecimal into the given byte array buffer,
at the bufOffset + offset of this field.
|
void |
setOffset(int offset) |
public PackedDecimalAsBigDecimalField(int offset, int precision, int scale, boolean signed)
offset
- int the offset of this fieldprecision
- in the number of decimal degits of precisionscale
- the number of implied decimal digits to the right of the decimal pointsigned
- boolean true if the value is signed, false if unsignedpublic int getByteLength()
getByteLength
in interface Field
public int getOffset()
public void setOffset(int offset)
setOffset
in interface Field
getOffset()
public int getPrecision()
public int getScale()
public boolean isSigned()
public java.math.BigDecimal getBigDecimal(byte[] buffer)
getBigDecimal
in interface BigDecimalAccessor
buffer
- the byte arraypublic java.math.BigDecimal getBigDecimal(byte[] buffer, int bufOffset)
getBigDecimal
in interface BigDecimalAccessor
buffer
- the byte arraybufOffset
- the additional offset into the byte arraypublic void putBigDecimal(java.math.BigDecimal value, byte[] buffer) throws java.lang.IllegalArgumentException
putBigDecimal
in interface BigDecimalAccessor
value
- the BigDecimal valuebuffer
- the byte arrayjava.lang.IllegalArgumentException
- if the value is out of rangepublic void putBigDecimal(java.math.BigDecimal value, byte[] buffer, int bufOffset) throws java.lang.IllegalArgumentException
putBigDecimal
in interface BigDecimalAccessor
value
- the BigDecimal valuebuffer
- the byte arraybufOffset
- the additional offset into the byte arrayjava.lang.IllegalArgumentException
- if the value is out of rangepublic boolean equals(java.math.BigDecimal a, java.math.BigDecimal b)
a
- BigDecimalb
- BigDecimal