public abstract static class EncodedInteger.Codec extends Object
Constructor and Description |
---|
EncodedInteger.Codec() |
Modifier and Type | Method and Description |
---|---|
int |
decode(byte[] data)
Decode the given bytearray to an integer value.
|
abstract int |
decode(byte[] data,
int start,
int len)
Decode a value from some part of a bytearray
|
abstract byte[] |
encode(int value)
Encode the given value to a new bytearray
|
abstract void |
encodeTo(int value,
byte[] toArray,
int start)
Encode the given value to some location in an existing bytearray
|
abstract void |
rangeCheck(int value)
Check if a given value is in the encodable range for this codec.
|
public int decode(byte[] data)
data
- the bytearraypublic abstract byte[] encode(int value)
value
- the valuepublic abstract void encodeTo(int value, byte[] toArray, int start)
value
- the valuetoArray
- the array to populatestart
- the start index to begin encoding atpublic abstract int decode(byte[] data, int start, int len)
data
- the bytearraystart
- where to start decodinglen
- how many bytes to decodepublic abstract void rangeCheck(int value) throws EncodeException
value
- the value to checkEncodeException
- if value
is out of range