public class PackedDecimalAsIntField extends java.lang.Object implements IntAccessor
Field
up to 9 digits (5 bytes) with int accessors.
Constructor and Description |
---|
PackedDecimalAsIntField(int offset,
int precision,
boolean signed)
Construct an instance
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Integer anInteger,
int anInt)
Compare an Integer, possibly null, with an int for equality.
|
int |
getByteLength()
Answer the length of the field described by the receiver
|
int |
getInt(byte[] buffer)
Answer a int from the given byte array buffer,
at the offset of this field.
|
int |
getInt(byte[] buffer,
int bufOffset)
Answer a int 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 |
putInt(int value,
byte[] buffer)
Put a int into the given byte array buffer,
at the offset of this field.
|
void |
putInt(int value,
byte[] buffer,
int bufOffset)
Put a int into the given byte array buffer,
at the bufOffset + offset of this field.
|
void |
setOffset(int offset) |
public PackedDecimalAsIntField(int offset, int precision, boolean signed)
offset
- position of this fieldprecision
- total number of digits <= 9.signed
- 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 int getInt(byte[] buffer)
getInt
in interface IntAccessor
buffer
- the byte arraypublic int getInt(byte[] buffer, int bufOffset)
getInt
in interface IntAccessor
buffer
- the byte arraybufOffset
- the additional offset into the byte arraypublic void putInt(int value, byte[] buffer) throws java.lang.IllegalArgumentException
putInt
in interface IntAccessor
value
- the signed int valuebuffer
- the byte arrayjava.lang.IllegalArgumentException
- if the value is out of rangepublic void putInt(int value, byte[] buffer, int bufOffset) throws java.lang.IllegalArgumentException
putInt
in interface IntAccessor
value
- 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 IntAccessor
public boolean equals(java.lang.Integer anInteger, int anInt)
anInteger
- anInt
-