|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.helidb.lang.serializer.ConfigurableLengthLongSerializer
org.helidb.lang.serializer.ConfigurableLengthLongNullSerializer
public class ConfigurableLengthLongNullSerializer
This Serializer
serializes Long
values to a
big-endian byte
array of configurable size. The length of the byte
array determines how big the serialized Long
:s can be. For a byte
array length of n
bytes, the maximum Integer
value is 2^(n*8)
, except if n
has its maximum value of 8, then the maximum
value is Long.MAX_VALUE
. Negative values are only supported if
n == 8
.
This serializer uses a special, configurable value to represent null
Long
:s.
LongNullSerializer
,
ConfigurableLengthLongSerializer
,
ConfigurableLengthIntegerNullSerializer
,
Long
Constructor Summary | |
---|---|
ConfigurableLengthLongNullSerializer(int valueSize)
Create a Serializer that uses the default value to represent
null . |
|
ConfigurableLengthLongNullSerializer(int valueSize,
long nullValue)
Create a Serializer . |
Method Summary | |
---|---|
Long |
interpret(byte[] barr)
Interpret the data in the byte array to an object of the type
handled by the Serializer implementation. |
Long |
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(Long val)
Serialize the supplied object into a new byte array. |
int |
serialize(Long val,
byte[] barr,
int offset)
Serialize the supplied object into the byte array. |
Methods inherited from class org.helidb.lang.serializer.ConfigurableLengthLongSerializer |
---|
getSerializedSize, read, read, readLong, readLong |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConfigurableLengthLongNullSerializer(int valueSize) throws IllegalArgumentException
Serializer
that uses the default value to represent
null
. The default value is the maximum allowed value for the
specified value size (or Long.MIN_VALUE
if the value size is
eight bytes). The null
value has the most significant bit of the
most significant byte set, which may be important to know when working
with Hasher
:s.
valueSize
- The number of bytes used to represent the value.
IllegalArgumentException
- If valueSize
is not in the range
1 <= valueSize <= 8
.public ConfigurableLengthLongNullSerializer(int valueSize, long nullValue) throws IllegalArgumentException
Serializer
.
valueSize
- The number of bytes used to represent the value.nullValue
- The value used to represent null
Long
:s.
IllegalArgumentException
- If nullValue
is out of range and
cannot be represented using valueSize
bytes, or if valueSize
is not in the range 1 <= valueSize <= 8
.Method Detail |
---|
public boolean isNullValuesPermitted()
Serializer
null
values?
isNullValuesPermitted
in interface Serializer<Long>
isNullValuesPermitted
in class ConfigurableLengthLongSerializer
true
, always.public Long 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<Long>
interpret
in class ConfigurableLengthLongSerializer
barr
- The byte
array containing the data.offset
- The start position of the data.length
- The length of the data.
Serializer.interpret(byte[])
public Long interpret(byte[] barr)
Serializer
byte
array to an object of the type
handled by the Serializer
implementation.
interpret
in interface Serializer<Long>
interpret
in class ConfigurableLengthLongSerializer
barr
- The byte
array containing the data.
Serializer.interpret(byte[], int, int)
public int serialize(Long val, byte[] barr, int offset)
Serializer
byte
array.
serialize
in interface Serializer<Long>
serialize
in class ConfigurableLengthLongSerializer
val
- 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(Long val)
Serializer
byte
array.
serialize
in interface Serializer<Long>
serialize
in class ConfigurableLengthLongSerializer
val
- The object to serialize.
byte
array.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |