java.lang.Object
com.ibm.jzos.fields.BinaryAsLongField
- All Implemented Interfaces:
Field
,LongAccessor
- Direct Known Subclasses:
BinarySignedLongField
,BinaryUnsignedLongField
A 4-8 byte binary
Field
with long accessors.
- Since:
- 2.1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
-
Constructor Summary
ConstructorsConstructorDescriptionBinaryAsLongField
(int offset) Construct a signed instance with a field width = DEFAULT_FIELD_WIDTH = 8.BinaryAsLongField
(int offset, int length) Construct a signed instance with a given offset and length.BinaryAsLongField
(int offset, int length, boolean signed) Construct an instance. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Compare a Long, possibly null, with a long for equality.int
Answer the length of the field described by the receiverlong
getLong
(byte[] buffer) Answer a long from the given byte array buffer, at the offset of this field.long
getLong
(byte[] buffer, int bufOffset) Answer a long from the given byte array buffer, at the bufOffset + offset of this field.int
Answer the offset of this field into some array of bytesboolean
isSigned()
Answer true if this field described a signed binary int, false if unsigned.void
putLong
(long value, byte[] buffer) Put a signed long into thegiven byte array buffer, at the bufOffset of this field.void
putLong
(long value, byte[] buffer, int bufOffset) Put a signed long into thegiven byte array buffer, at the bufOffset + offset of this field.void
setOffset
(int offset) void
setSigned
(boolean signed) Deprecated.Change the sign of the field.
-
Field Details
-
MAX_FIELD_WIDTH
public static final int MAX_FIELD_WIDTH- See Also:
-
DEFAULT_FIELD_WIDTH
public static final int DEFAULT_FIELD_WIDTH- See Also:
-
SIGNED_MIN_LEN1_VAL
public static final long SIGNED_MIN_LEN1_VAL- See Also:
-
SIGNED_MAX_LEN1_VAL
public static final long SIGNED_MAX_LEN1_VAL- See Also:
-
SIGNED_MIN_LEN2_VAL
public static final long SIGNED_MIN_LEN2_VAL- See Also:
-
SIGNED_MAX_LEN2_VAL
public static final long SIGNED_MAX_LEN2_VAL- See Also:
-
SIGNED_MIN_LEN3_VAL
public static final long SIGNED_MIN_LEN3_VAL- See Also:
-
SIGNED_MAX_LEN3_VAL
public static final long SIGNED_MAX_LEN3_VAL- See Also:
-
SIGNED_MIN_LEN4_VAL
public static final long SIGNED_MIN_LEN4_VAL- See Also:
-
SIGNED_MAX_LEN4_VAL
public static final long SIGNED_MAX_LEN4_VAL- See Also:
-
SIGNED_MIN_LEN5_VAL
public static final long SIGNED_MIN_LEN5_VAL- See Also:
-
SIGNED_MAX_LEN5_VAL
public static final long SIGNED_MAX_LEN5_VAL- See Also:
-
SIGNED_MIN_LEN6_VAL
public static final long SIGNED_MIN_LEN6_VAL- See Also:
-
SIGNED_MAX_LEN6_VAL
public static final long SIGNED_MAX_LEN6_VAL- See Also:
-
SIGNED_MIN_LEN7_VAL
public static final long SIGNED_MIN_LEN7_VAL- See Also:
-
SIGNED_MAX_LEN7_VAL
public static final long SIGNED_MAX_LEN7_VAL- See Also:
-
SIGNED_MIN_LEN8_VAL
public static final long SIGNED_MIN_LEN8_VAL- See Also:
-
SIGNED_MAX_LEN8_VAL
public static final long SIGNED_MAX_LEN8_VAL- See Also:
-
UNSIGNED_MAX_LEN1_VAL
public static final long UNSIGNED_MAX_LEN1_VAL- See Also:
-
UNSIGNED_MAX_LEN2_VAL
public static final long UNSIGNED_MAX_LEN2_VAL- See Also:
-
UNSIGNED_MAX_LEN3_VAL
public static final long UNSIGNED_MAX_LEN3_VAL- See Also:
-
UNSIGNED_MAX_LEN4_VAL
public static final long UNSIGNED_MAX_LEN4_VAL- See Also:
-
UNSIGNED_MAX_LEN5_VAL
public static final long UNSIGNED_MAX_LEN5_VAL- See Also:
-
UNSIGNED_MAX_LEN6_VAL
public static final long UNSIGNED_MAX_LEN6_VAL- See Also:
-
UNSIGNED_MAX_LEN7_VAL
public static final long UNSIGNED_MAX_LEN7_VAL- See Also:
-
UNSIGNED_MAX_LEN8_VAL
public static final long UNSIGNED_MAX_LEN8_VAL- See Also:
-
-
Constructor Details
-
BinaryAsLongField
public BinaryAsLongField(int offset) Construct a signed instance with a field width = DEFAULT_FIELD_WIDTH = 8.- Parameters:
offset
- int the offset in some byte array to the start of this field.
-
BinaryAsLongField
public BinaryAsLongField(int offset, int length) Construct a signed instance with a given offset and length.- Parameters:
offset
- int the offset in some byte array to the start of this field.length
- int the size of the field in bytes
-
BinaryAsLongField
public BinaryAsLongField(int offset, int length, boolean signed) Construct an instance.- Parameters:
offset
- int the offset in some byte array to the start of this field.length
- int the size of the field in bytessigned
- boolean true if the field is signed, false if unsigned.
-
-
Method Details
-
getByteLength
public int getByteLength()Answer the length of the field described by the receiver- Specified by:
getByteLength
in interfaceField
- Returns:
- int
-
getOffset
public int getOffset()Answer the offset of this field into some array of bytes -
setOffset
public void setOffset(int offset) -
getLong
public long getLong(byte[] buffer, int bufOffset) Answer a long from the given byte array buffer, at the bufOffset + offset of this field.- Specified by:
getLong
in interfaceLongAccessor
- Parameters:
buffer
- the byte arraybufOffset
- the additional offset into the byte array- Returns:
- long
- Throws:
IllegalArgumentException
- if the value in the field is unsigned and too large to be represented as a java long
-
getLong
public long getLong(byte[] buffer) Answer a long from the given byte array buffer, at the offset of this field.- Specified by:
getLong
in interfaceLongAccessor
- Parameters:
buffer
- the byte array- Returns:
- long
- Throws:
IllegalArgumentException
- if the value in the field is unsigned and too large to be represented as a java long
-
putLong
Put a signed long into thegiven byte array buffer, at the bufOffset + offset of this field.- Specified by:
putLong
in interfaceLongAccessor
- Parameters:
value
- the signed long valuebuffer
- the byte arraybufOffset
- the additional offset into the byte array- Throws:
IllegalArgumentException
- if the value is out of range
-
putLong
Put a signed long into thegiven byte array buffer, at the bufOffset of this field.- Specified by:
putLong
in interfaceLongAccessor
- Parameters:
value
- the signed long valuebuffer
- the byte array- Throws:
IllegalArgumentException
- if the value is out of range
-
isSigned
public boolean isSigned()Answer true if this field described a signed binary int, false if unsigned.- Specified by:
isSigned
in interfaceLongAccessor
-
setSigned
Deprecated.Change the sign of the field. When Data Access Acceleration (DAA) is enabled, this method is not supported and an UnsupportedOperationException will be thrown.- See Also:
-
equals
Compare a Long, possibly null, with a long for equality.- Parameters:
aLong
-along
-- Returns:
- boolean true if equal, false otherwise
-