LongFieldpublic class LongField extends Object implements FixedFieldrepresentation of a long (16-bit) field at a fixed location within
a byte array |
Fields Summary |
---|
private long | _value | private final int | _offset |
Constructors Summary |
---|
public LongField(int offset)construct the LongField with its offset into its containing
byte array
if (offset < 0)
{
throw new ArrayIndexOutOfBoundsException("Illegal offset: "
+ offset);
}
_offset = offset;
| public LongField(int offset, long value)construct the LongField with its offset into its containing
byte array and initialize its value
this(offset);
set(value);
| public LongField(int offset, byte[] data)Construct the LongField with its offset into its containing
byte array and initialize its value from its byte array
this(offset);
readFromBytes(data);
| public LongField(int offset, long value, byte[] data)construct the LongField with its offset into its containing
byte array, initialize its value, and write the value to a byte
array
this(offset);
set(value, data);
|
Methods Summary |
---|
public long | get()get the LongField's current value
return _value;
| public void | readFromBytes(byte[] data)set the value from its offset into an array of bytes
_value = LittleEndian.getLong(data, _offset);
| public void | readFromStream(java.io.InputStream stream)set the value from an InputStream
_value = LittleEndian.readLong(stream);
| public void | set(long value)set the LongField's current value
_value = value;
| public void | set(long value, byte[] data)set the LongField's current value and write it to a byte array
_value = value;
writeToBytes(data);
| public java.lang.String | toString()return the value as a String
return String.valueOf(_value);
| public void | writeToBytes(byte[] data)write the value out to an array of bytes at the appropriate
offset
LittleEndian.putLong(data, _offset, _value);
|
|