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
IOExceptionprotected EncodedInteger(EncodedInteger.Codec codec, int value) throws EncodeException
EncodeExceptionprotected 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
IOExceptionpublic final short shortValue()
shortValue in class Numberpublic final float floatValue()
floatValue in class Numberpublic final double doubleValue()
doubleValue in class Numberpublic Object clone()
DataObjectInherently immutable objects may optionally return the same object without modification from clone(), rather than constructing a new instance.
clone in interface DataObjectclone in class Objectpublic void setReadOnly()
DataObjectNote 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 DataObjectpublic boolean isReadOnly()
DataObjectisReadOnly in interface DataObjectDataObject.setReadOnly()