|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.helidb.lang.serializer.ShortSerializer
org.helidb.lang.serializer.ShortNullSerializer
public class ShortNullSerializer
A Serializer
for Short
values that may be null
. Short
values are serialized to a two bytes long, big-endian
byte array. A special, configurable value is used to represent null
.
The singleton instance INSTANCE
uses Short.MIN_VALUE
to
represent null
values. It may be used instead of instantiating this
class.
ShortSerializer
,
Short
Field Summary | |
---|---|
static ShortNullSerializer |
INSTANCE
The singleton instance. |
Fields inherited from class org.helidb.lang.serializer.ShortSerializer |
---|
DATA_SIZE |
Constructor Summary | |
---|---|
ShortNullSerializer(short nullValue)
Instantiate this class. |
Method Summary | |
---|---|
Short |
interpret(byte[] barr)
Interpret the data in the byte array to an object of the type
handled by the Serializer implementation. |
Short |
interpret(byte[] barr,
int offset,
int length)
Interpret the data in the byte array to an object of the type
handled by the Serializer implementation. |
boolean |
isNullValuesPermitted()
Does this serializer permit null values? |
byte[] |
serialize(Short value)
Serialize the supplied object into a new byte array. |
int |
serialize(Short value,
byte[] barr,
int offset)
Serialize the supplied object into the byte array. |
Methods inherited from class org.helidb.lang.serializer.ShortSerializer |
---|
encodeShort, getSerializedSize, getShort, read, read, readShort, readShort |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final ShortNullSerializer INSTANCE
Short.MIN_VALUE
to represent null
values. That
null
value has the most significant bit of the most significant
byte set, which may be important to know when working with
Hasher
:s.
Constructor Detail |
---|
public ShortNullSerializer(short nullValue)
nullValue
- The value used to represent null
Short
:s.Method Detail |
---|
public Short interpret(byte[] barr, int offset, int length)
Serializer
byte
array to an object of the type
handled by the Serializer
implementation.
interpret
in interface Serializer<Short>
interpret
in class ShortSerializer
barr
- The byte
array containing the data.offset
- The start position of the data.length
- The length of the data.
Serializer.interpret(byte[])
public Short interpret(byte[] barr)
Serializer
byte
array to an object of the type
handled by the Serializer
implementation.
interpret
in interface Serializer<Short>
interpret
in class ShortSerializer
barr
- The byte
array containing the data.
Serializer.interpret(byte[], int, int)
public int serialize(Short value, byte[] barr, int offset)
Serializer
byte
array.
serialize
in interface Serializer<Short>
serialize
in class ShortSerializer
value
- The object to serialize.barr
- The byte array to serialize it to.offset
- The start position to write data at in the byte array.
public byte[] serialize(Short value)
Serializer
byte
array.
serialize
in interface Serializer<Short>
serialize
in class ShortSerializer
value
- The object to serialize.
byte
array.public boolean isNullValuesPermitted()
Serializer
null
values?
isNullValuesPermitted
in interface Serializer<Short>
isNullValuesPermitted
in class ShortSerializer
true
, always.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |