com.ibm.jzos.fields

Class PackedDecimalAsBigIntegerField

  • java.lang.Object
    • com.ibm.jzos.fields.PackedDecimalAsBigIntegerField
  • All Implemented Interfaces:
    BigIntegerAccessor, Field


    public class PackedDecimalAsBigIntegerField
    extends java.lang.Object
    implements BigIntegerAccessor
    A packed decimal Field up to 31 digits with BigInteger accessors.

    Since:
    2.1.0
    • Constructor Summary

      Constructors 
      Constructor and Description
      PackedDecimalAsBigIntegerField(int offset, int precision, int scale, boolean signed)
      Construct an instance
    • Method Summary

      Methods 
      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) 
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PackedDecimalAsBigIntegerField

        public PackedDecimalAsBigIntegerField(int offset,
                                      int precision,
                                      int scale,
                                      boolean signed)
        Construct an instance
        Parameters:
        offset - position of this field
        precision - 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 field
        signed - if true the last nibble is a sign
    • Method Detail

      • getByteLength

        public int getByteLength()
        Answer the length of the field described by the receiver
        Specified by:
        getByteLength in interface Field
        Returns:
        int
      • getOffset

        public int getOffset()
        Answer the offset of this field into some array of bytes
        Specified by:
        getOffset in interface Field
        Returns:
        int
      • getPrecision

        public int getPrecision()
        Answer the number of decimal digits of precision.
        Returns:
        int
      • getBigInteger

        public java.math.BigInteger getBigInteger(byte[] buffer)
                                           throws java.lang.IllegalArgumentException
        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:
        getBigInteger in interface BigIntegerAccessor
        Parameters:
        buffer - the byte array
        Returns:
        BigInteger
        Throws:
        java.lang.IllegalArgumentException - if the field contains an invalid sign
      • getBigInteger

        public java.math.BigInteger getBigInteger(byte[] buffer,
                                         int bufOffset)
                                           throws java.lang.IllegalArgumentException
        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:
        getBigInteger in interface BigIntegerAccessor
        Parameters:
        buffer - the byte array
        bufOffset - the additional offset into the byte array
        Returns:
        BigInteger
        Throws:
        java.lang.IllegalArgumentException - if the field contains an invalid sign
      • putBigInteger

        public void putBigInteger(java.math.BigInteger value,
                         byte[] buffer)
                           throws java.lang.IllegalArgumentException
        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:
        putBigInteger in interface BigIntegerAccessor
        Parameters:
        value - the BigInteger value
        buffer - the byte array
        Throws:
        java.lang.IllegalArgumentException - if the value is out of range
      • putBigInteger

        public void putBigInteger(java.math.BigInteger value,
                         byte[] buffer,
                         int bufOffset)
                           throws java.lang.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:
        putBigInteger in interface BigIntegerAccessor
        Parameters:
        value - the BigInteger value
        buffer - the byte array
        bufOffset - the additional offset into the byte array
        Throws:
        java.lang.IllegalArgumentException - if the value is out of range
      • equals

        public boolean equals(java.math.BigInteger a,
                     java.math.BigInteger b)
        Compare two BigInteger instances, possibly null, for equality.
        Parameters:
        a - BigInteger
        b - BigInteger
        Returns:
        boolean true if equal, false otherwise
      • getScale

        public int getScale()
      • isSigned

        public boolean isSigned()
© Copyright IBM Corporation 2005, 2014.