com.ibm.jzos.fields
Class ExternalDecimalAsIntField
- java.lang.Object
-
- com.ibm.jzos.fields.ExternalDecimalAsIntField
-
- All Implemented Interfaces:
- Field, IntAccessor
- Direct Known Subclasses:
- ZonedEmbeddedLeadingSignedIntField, ZonedEmbeddedTrailingSignedIntField, ZonedExternalLeadingSignedIntField, ZonedExternalTrailingSignedIntField, ZonedUnsignedIntField
public class ExternalDecimalAsIntField extends java.lang.Object implements IntAccessor
An external (aka "display", "zoned") decimal field up to 9 digits with int accessors.- Since:
- 2.1.0
-
-
Constructor Summary
Constructors Constructor and Description ExternalDecimalAsIntField(int offset, int precision, boolean signed, boolean signTrailing, boolean signExternal, boolean blankWhenZero)Construct an instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanequals(java.lang.Integer anInteger, int anInt)Compare an Integer, possibly null, with an int for equality.intgetByteLength()Answer the length of the field described by the receiverintgetInt(byte[] buffer)Answer an int value from the given byte array buffer, at the offset of this field.intgetInt(byte[] buffer, int bufOffset)Answer an int value from the given byte array buffer, at the bufOffset + offset of this field.intgetLength()intgetOffset()Answer the offset of this field into some array of bytesintgetPrecision()booleanisBlankWhenZero()booleanisSigned()Answer whether the field is signedbooleanisSignExternal()booleanisSignTrailing()voidputInt(int value, byte[] buffer)Put an int value into the given byte array buffer, at the offset of this field.voidputInt(int value, byte[] buffer, int bufOffset)Put an int value into the given byte array buffer, at the bufOffset + offset of this field.voidsetOffset(int offset)
-
-
-
Constructor Detail
-
ExternalDecimalAsIntField
public ExternalDecimalAsIntField(int offset, int precision, boolean signed, boolean signTrailing, boolean signExternal, boolean blankWhenZero)Construct an instance- Parameters:
offset- position of this fieldprecision- total number of digits <= 9.signed- if the field has a sign somewheresignTrailing- true if the sign follows the field, false if it precedes itsignExternal- true if the sign occupies a separate byte, false if it only occupies a high-order nibble Note: signTailing and signExternal are ignored if signed is not true.
-
-
Method Detail
-
getByteLength
public int getByteLength()
Description copied from interface:FieldAnswer the length of the field described by the receiver- Specified by:
getByteLengthin interfaceField- Returns:
- int
-
getOffset
public int getOffset()
Description copied from interface:FieldAnswer the offset of this field into some array of bytes
-
setOffset
public void setOffset(int offset)
- Specified by:
setOffsetin interfaceField- See Also:
Field.getOffset()
-
getInt
public int getInt(byte[] buffer)
Answer an int value from the given byte array buffer, at the offset of this field.- Specified by:
getIntin interfaceIntAccessor- Parameters:
buffer- the byte array- Returns:
- int
-
getInt
public int getInt(byte[] buffer, int bufOffset)Answer an int value from the given byte array buffer, at the bufOffset + offset of this field.- Specified by:
getIntin interfaceIntAccessor- Parameters:
buffer- the byte arraybufOffset- the additional offset into the byte array- Returns:
- int
-
putInt
public void putInt(int value, byte[] buffer) throws java.lang.IllegalArgumentExceptionPut an int value into the given byte array buffer, at the offset of this field.- Specified by:
putIntin interfaceIntAccessor- Parameters:
value- the signed int valuebuffer- the byte array- Throws:
java.lang.IllegalArgumentException- if the value is out of range
-
putInt
public void putInt(int value, byte[] buffer, int bufOffset) throws java.lang.IllegalArgumentExceptionPut an int value into the given byte array buffer, at the bufOffset + offset of this field.- Specified by:
putIntin interfaceIntAccessor- Parameters:
value- the int valuebuffer- the byte arraybufOffset- the additional offset into the byte array- Throws:
java.lang.IllegalArgumentException- if the value is out of range
-
isSigned
public boolean isSigned()
Answer whether the field is signed- Specified by:
isSignedin interfaceIntAccessor
-
equals
public boolean equals(java.lang.Integer anInteger, int anInt)Compare an Integer, possibly null, with an int for equality.- Parameters:
anInteger-anInt-- Returns:
- boolean true if equal, false otherwise
-
isBlankWhenZero
public boolean isBlankWhenZero()
-
getLength
public int getLength()
-
getPrecision
public int getPrecision()
-
isSignExternal
public boolean isSignExternal()
-
isSignTrailing
public boolean isSignTrailing()
-
-