public abstract class EncodedInteger extends Number implements DataObject, Immutable
Modifier and Type | Class and Description |
---|---|
static class |
EncodedInteger.Codec
Every EncodedInteger instance has an associated Codec instance
that knows how to encode / decode / range-check integers of that type.
|
static class |
EncodedInteger.GenericCodec
A generic codec that can encode big- or little-endian values of variable
width and signedness.
|
Modifier and Type | Field and Description |
---|---|
static EncodedInteger.Codec |
S16BE
A signed 16-bit integer encoded in 2 bytes, MSB-first
|
static EncodedInteger.Codec |
S16LE
A signed 16-bit integer encoded in 2 bytes, LSB-first
|
static EncodedInteger.Codec |
S24BE
A signed 24-bit integer encoded in 3 bytes, MSB-first
|
static EncodedInteger.Codec |
S24LE
A signed 24-bit integer encoded in 3 bytes, LSB-first
|
static EncodedInteger.Codec |
S32BE
A signed 32-bit integer encoded in 4 bytes, MSB-first
|
static EncodedInteger.Codec |
S32LE
A signed 32-bit integer encoded in 4 bytes, LSB-first
|
static EncodedInteger.Codec |
S8
A signed 8-bit integer encoded in 1 byte
|
static EncodedInteger.Codec |
U16BE
An unsigned 16-bit integer encoded in 2 bytes, MSB-first
|
static EncodedInteger.Codec |
U16LE
An unsigned 16-bit integer encoded in 2 bytes, LSB-first
|
static EncodedInteger.Codec |
U24BE
An unsigned 24-bit integer encoded in 3 bytes, MSB-first
|
static EncodedInteger.Codec |
U24LE
An unsigned 24-bit integer encoded in 3 bytes, LSB-first
|
static EncodedInteger.Codec |
U8
An unsigned 8-bit integer encoded in 1 byte
|
Modifier | Constructor and Description |
---|---|
protected |
EncodedInteger(EncodedInteger.Codec codec,
byte[] data) |
protected |
EncodedInteger(EncodedInteger.Codec codec,
byte[] data,
int start,
int len) |
protected |
EncodedInteger(EncodedInteger.Codec codec,
DataInput input) |
protected |
EncodedInteger(EncodedInteger.Codec codec,
int value) |
Modifier and Type | Method and Description |
---|---|
byte |
byteValue() |
Object |
clone()
Perform a deep copy of this object.
|
double |
doubleValue() |
boolean |
equals(Object o) |
float |
floatValue() |
static EncodedInteger.Codec |
getCodec(int min,
int max,
int width,
boolean bigEndian,
boolean signed) |
byte[] |
getEncodedForm() |
int |
hashCode() |
int |
intValue() |
boolean |
isReadOnly()
Check if this object has been set read-only.
|
long |
longValue() |
void |
setReadOnly()
Set this object to be "read-only".
|
short |
shortValue() |
void |
toStream(DataOutput out) |
String |
toString() |
public static final EncodedInteger.Codec U8
public static final EncodedInteger.Codec U16BE
public static final EncodedInteger.Codec U16LE
public static final EncodedInteger.Codec U24BE
public static final EncodedInteger.Codec U24LE
public static final EncodedInteger.Codec S8
public static final EncodedInteger.Codec S16BE
public static final EncodedInteger.Codec S16LE
public static final EncodedInteger.Codec S24BE
public static final EncodedInteger.Codec S24LE
public static final EncodedInteger.Codec S32BE
public static final EncodedInteger.Codec S32LE
protected EncodedInteger(EncodedInteger.Codec codec, DataInput input) throws IOException
IOException
protected EncodedInteger(EncodedInteger.Codec codec, int value) throws EncodeException
EncodeException
protected EncodedInteger(EncodedInteger.Codec codec, byte[] data)
protected EncodedInteger(EncodedInteger.Codec codec, byte[] data, int start, int len)
public static EncodedInteger.Codec getCodec(int min, int max, int width, boolean bigEndian, boolean signed)
public byte[] getEncodedForm()
public void toStream(DataOutput out) throws IOException
IOException
public final short shortValue()
shortValue
in class Number
public final float floatValue()
floatValue
in class Number
public final double doubleValue()
doubleValue
in class Number
public Object clone()
DataObject
Inherently immutable objects may optionally return the same object without modification from clone(), rather than constructing a new instance.
clone
in interface DataObject
clone
in class Object
public void setReadOnly()
DataObject
Note that a read-only object is not necessarily immutable; if reference types are returned from accessors, then callers could theoretically mutate those objects even if the top-level object is marked as read-only. The ability to make objects read-only is intended to catch programming errors (e.g. attempting to modify a data object passed as part of a SLEE event), not to provide an absolute guarantee of immutability.
Calling setReadOnly() on an object that is already read-only is a no-op.
Some DataObject implementations may be inherently immutable. In those cases, they are considered always read-only.
setReadOnly
in interface DataObject
public boolean isReadOnly()
DataObject
isReadOnly
in interface DataObject
DataObject.setReadOnly()