java.lang.Object
com.ibm.jzos.fields.PackedDecimalAsBigIntegerField
- All Implemented Interfaces:
BigIntegerAccessor,Field
A packed decimal
Field up to 31 digits with BigInteger accessors.
- Since:
- 2.1.0
-
Constructor Summary
ConstructorsConstructorDescriptionPackedDecimalAsBigIntegerField(int offset, int precision, int scale, boolean signed) Construct an instance -
Method Summary
Modifier and TypeMethodDescriptionbooleanequals(BigInteger a, BigInteger b) Compare two BigInteger instances, possibly null, for equality.getBigInteger(byte[] buffer) Answer a BigInteger value from the given byte array buffer, at the offset of this field.getBigInteger(byte[] buffer, int bufOffset) Answer a BigInteger value from the given byte array buffer, at the bufOffset + offset of this field.intAnswer the length of the field described by the receiverintAnswer the offset of this field into some array of bytesintAnswer the number of decimal digits of precision.intgetScale()booleanisSigned()voidputBigInteger(BigInteger value, byte[] buffer) Put a BigInteger value into the given byte array buffer, at the offset of this field.voidputBigInteger(BigInteger value, byte[] buffer, int bufOffset) Put a BigInteger value into the given byte array buffer, at the bufOffset + offset of this field.voidsetOffset(int offset)
-
Constructor Details
-
PackedDecimalAsBigIntegerField
public PackedDecimalAsBigIntegerField(int offset, int precision, int scale, boolean signed) Construct an instance- Parameters:
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 sign
-
-
Method Details
-
getByteLength
public int getByteLength()Answer the length of the field described by the receiver- Specified by:
getByteLengthin interfaceField- Returns:
- int
-
getOffset
public int getOffset()Answer the offset of this field into some array of bytes -
setOffset
public void setOffset(int offset) -
getPrecision
public int getPrecision()Answer the number of decimal digits of precision.- Returns:
- int
-
getBigInteger
Answer a BigInteger value from the given byte array buffer, at the offset of this field.Note: the data is not checked for valid decimal digits, although the sign nibble is checked for a valid value in the range x'A'-x'F'.
- Specified by:
getBigIntegerin interfaceBigIntegerAccessor- Parameters:
buffer- the byte array- Returns:
- BigInteger
- Throws:
IllegalArgumentException- if the field contains an invalid sign
-
getBigInteger
Answer a BigInteger value from the given byte array buffer, at the bufOffset + offset of this field.Note: the data is not checked for valid decimal digits, although the sign nibble is checked for a valid value in the range x'A'-x'F'.
- Specified by:
getBigIntegerin interfaceBigIntegerAccessor- Parameters:
buffer- the byte arraybufOffset- the additional offset into the byte array- Returns:
- BigInteger
- Throws:
IllegalArgumentException- if the field contains an invalid sign
-
putBigInteger
Put a BigInteger value into the given byte array buffer, at the offset of this field.Note: if the field is unsigned, a x'F' is supplied as the sign nibble in the field.
- Specified by:
putBigIntegerin interfaceBigIntegerAccessor- Parameters:
value- the BigInteger valuebuffer- the byte array- Throws:
IllegalArgumentException- if the value is out of range
-
putBigInteger
public void putBigInteger(BigInteger value, byte[] buffer, int bufOffset) throws IllegalArgumentException Put a BigInteger value into the given byte array buffer, at the bufOffset + offset of this field.Note: if the field is unsigned, a x'F' is supplied as the sign nibble in the field.
- Specified by:
putBigIntegerin interfaceBigIntegerAccessor- Parameters:
value- the BigInteger valuebuffer- the byte arraybufOffset- the additional offset into the byte array- Throws:
IllegalArgumentException- if the value is out of range
-
equals
Compare two BigInteger instances, possibly null, for equality.- Parameters:
a- BigIntegerb- BigInteger- Returns:
- boolean true if equal, false otherwise
-
getScale
public int getScale() -
isSigned
public boolean isSigned()
-