public class BinaryAsLongField extends java.lang.Object implements LongAccessor
Field
with long accessors.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_FIELD_WIDTH |
static int |
MAX_FIELD_WIDTH |
static long |
SIGNED_MAX_LEN1_VAL |
static long |
SIGNED_MAX_LEN2_VAL |
static long |
SIGNED_MAX_LEN3_VAL |
static long |
SIGNED_MAX_LEN4_VAL |
static long |
SIGNED_MAX_LEN5_VAL |
static long |
SIGNED_MAX_LEN6_VAL |
static long |
SIGNED_MAX_LEN7_VAL |
static long |
SIGNED_MAX_LEN8_VAL |
static long |
SIGNED_MIN_LEN1_VAL |
static long |
SIGNED_MIN_LEN2_VAL |
static long |
SIGNED_MIN_LEN3_VAL |
static long |
SIGNED_MIN_LEN4_VAL |
static long |
SIGNED_MIN_LEN5_VAL |
static long |
SIGNED_MIN_LEN6_VAL |
static long |
SIGNED_MIN_LEN7_VAL |
static long |
SIGNED_MIN_LEN8_VAL |
static long |
UNSIGNED_MAX_LEN1_VAL |
static long |
UNSIGNED_MAX_LEN2_VAL |
static long |
UNSIGNED_MAX_LEN3_VAL |
static long |
UNSIGNED_MAX_LEN4_VAL |
static long |
UNSIGNED_MAX_LEN5_VAL |
static long |
UNSIGNED_MAX_LEN6_VAL |
static long |
UNSIGNED_MAX_LEN7_VAL |
static long |
UNSIGNED_MAX_LEN8_VAL |
Constructor and Description |
---|
BinaryAsLongField(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.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Long aLong,
long along)
Compare a Long, possibly null, with a long for equality.
|
int |
getByteLength()
Answer the length of the field described by the receiver
|
long |
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 |
getOffset()
Answer the offset of this field into some array of bytes
|
boolean |
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) |
public static final int MAX_FIELD_WIDTH
public static final int DEFAULT_FIELD_WIDTH
public static final long SIGNED_MIN_LEN1_VAL
public static final long SIGNED_MAX_LEN1_VAL
public static final long SIGNED_MIN_LEN2_VAL
public static final long SIGNED_MAX_LEN2_VAL
public static final long SIGNED_MIN_LEN3_VAL
public static final long SIGNED_MAX_LEN3_VAL
public static final long SIGNED_MIN_LEN4_VAL
public static final long SIGNED_MAX_LEN4_VAL
public static final long SIGNED_MIN_LEN5_VAL
public static final long SIGNED_MAX_LEN5_VAL
public static final long SIGNED_MIN_LEN6_VAL
public static final long SIGNED_MAX_LEN6_VAL
public static final long SIGNED_MIN_LEN7_VAL
public static final long SIGNED_MAX_LEN7_VAL
public static final long SIGNED_MIN_LEN8_VAL
public static final long SIGNED_MAX_LEN8_VAL
public static final long UNSIGNED_MAX_LEN1_VAL
public static final long UNSIGNED_MAX_LEN2_VAL
public static final long UNSIGNED_MAX_LEN3_VAL
public static final long UNSIGNED_MAX_LEN4_VAL
public static final long UNSIGNED_MAX_LEN5_VAL
public static final long UNSIGNED_MAX_LEN6_VAL
public static final long UNSIGNED_MAX_LEN7_VAL
public static final long UNSIGNED_MAX_LEN8_VAL
public BinaryAsLongField(int offset)
offset
- int the offset in some byte array to the start of this field.public BinaryAsLongField(int offset, int length)
offset
- int the offset in some byte array to the start of this field.length
- int the size of the field in bytespublic BinaryAsLongField(int offset, int length, boolean signed)
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.public int getByteLength()
getByteLength
in interface Field
public int getOffset()
public void setOffset(int offset)
setOffset
in interface Field
getOffset()
public long getLong(byte[] buffer, int bufOffset)
getLong
in interface LongAccessor
buffer
- the byte arraybufOffset
- the additional offset into the byte arrayjava.lang.IllegalArgumentException
- if the value in the field is unsigned and too large to be represented as a java longpublic long getLong(byte[] buffer)
getLong
in interface LongAccessor
buffer
- the byte arrayjava.lang.IllegalArgumentException
- if the value in the field is unsigned and too large to be represented as a java longpublic void putLong(long value, byte[] buffer, int bufOffset) throws java.lang.IllegalArgumentException
putLong
in interface LongAccessor
value
- the signed long valuebuffer
- the byte arraybufOffset
- the additional offset into the byte arrayjava.lang.IllegalArgumentException
- if the value is out of rangepublic void putLong(long value, byte[] buffer) throws java.lang.IllegalArgumentException
putLong
in interface LongAccessor
value
- the signed long valuebuffer
- the byte arrayjava.lang.IllegalArgumentException
- if the value is out of rangepublic boolean isSigned()
isSigned
in interface LongAccessor
public void setSigned(boolean signed)
isSigned()
public boolean equals(java.lang.Long aLong, long along)
aLong
- along
-