com.ibm.jzos.fields
Class BinaryAsBigIntegerField

java.lang.Object
  extended by com.ibm.jzos.fields.BinaryAsBigIntegerField
All Implemented Interfaces:
BigIntegerAccessor, Field
Direct Known Subclasses:
BinaryAsBigDecimalField

public class BinaryAsBigIntegerField
extends java.lang.Object
implements BigIntegerAccessor

A binary field with BigInteger accessors.

See Also:
Field, BigIntegerAccessor

Constructor Summary
BinaryAsBigIntegerField(int offset, int length, boolean signed)
          Construct an instance.
BinaryAsBigIntegerField(int offset, int length, int scale, boolean signed)
          Construct an instance.
 
Method Summary
 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 from the given byte array buffer, at the offset of this field.
 java.math.BigInteger getBigInteger(byte[] buffer, int bufOffset)
          Answer a BigInteger 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 getLength()
           
 int getOffset()
          Answer the offset of this field into some array of bytes
 int getScale()
           
 boolean isSigned()
           
 void putBigInteger(java.math.BigInteger value, byte[] buffer)
          Put a BigInteger 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 into the given byte array buffer, at the bufOffset + offset of this field.
 void setOffset(int offset)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryAsBigIntegerField

public BinaryAsBigIntegerField(int offset,
                               int length,
                               boolean signed)
Construct an instance.

Parameters:
offset - int the offset of this field
length - int the size of the field in bytes
signed - boolean true if the value is signed, false if unsigned

BinaryAsBigIntegerField

public BinaryAsBigIntegerField(int offset,
                               int length,
                               int scale,
                               boolean signed)
Construct an instance.

Parameters:
offset - int the offset of this field
length - int the size of the field in bytes
scale - a number <=0 implying a scaling factor to be muliplied by the stored byte value. For example, -1, would mean that the external value was 10 times the internal value.
signed - boolean true if the value is signed, false if unsigned
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

setOffset

public void setOffset(int offset)
Specified by:
setOffset in interface Field
See Also:
getOffset()

getScale

public int getScale()
Returns:
int the scale <= 0

getBigInteger

public java.math.BigInteger getBigInteger(byte[] buffer,
                                          int bufOffset)
Answer a BigInteger from the given byte array buffer, at the bufOffset + offset of this field.

Specified by:
getBigInteger in interface BigIntegerAccessor
Parameters:
buffer - the byte array
bufOffset - the additional offset into the byte array
Returns:
BigInteger

getBigInteger

public java.math.BigInteger getBigInteger(byte[] buffer)
Answer a BigInteger from the given byte array buffer, at the offset of this field.

Specified by:
getBigInteger in interface BigIntegerAccessor
Parameters:
buffer - the byte array
Returns:
BigInteger

putBigInteger

public void putBigInteger(java.math.BigInteger value,
                          byte[] buffer,
                          int bufOffset)
                   throws java.lang.IllegalArgumentException
Put a BigInteger into the given byte array buffer, at the bufOffset + offset of this 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

putBigInteger

public void putBigInteger(java.math.BigInteger value,
                          byte[] buffer)
                   throws java.lang.IllegalArgumentException
Put a BigInteger into the given byte array buffer, at the offset of this 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

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

getLength

public int getLength()

isSigned

public boolean isSigned()