|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.helidb.lang.serializer.SerializableSerializer<T>
public class SerializableSerializer<T extends Serializable>
This is a Serializer
for generic Serializable
objects.
Often, using a custom serializer for the serialized class is preferable since that gives greater control over how data is stored.
Constructor Summary | |
---|---|
SerializableSerializer()
|
Method Summary | |
---|---|
int |
getSerializedSize()
If the serialized data produced by this serializer always is of the same size, return that size (in number of bytes). |
T |
interpret(byte[] barr)
Interpret the data in the byte array to an object of the type
handled by the Serializer implementation. |
T |
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? |
T |
read(InputStream is,
int size)
Read a value from the InputStream . |
T |
read(RandomAccess ra,
int size)
Read a value from the RandomAccess ' current position. |
byte[] |
serialize(T o)
Serialize the supplied object into a new byte array. |
int |
serialize(T o,
byte[] barr,
int offset)
Serialize the supplied object into the byte array. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SerializableSerializer()
Method Detail |
---|
public int getSerializedSize()
Serializer
-1
is
returned.
getSerializedSize
in interface Serializer<T extends Serializable>
-1
(variable size).public boolean isNullValuesPermitted()
Serializer
null
values?
isNullValuesPermitted
in interface Serializer<T extends Serializable>
false
.public T interpret(byte[] barr)
Serializer
byte
array to an object of the type
handled by the Serializer
implementation.
interpret
in interface Serializer<T extends Serializable>
barr
- The byte
array containing the data.
Serializer.interpret(byte[], int, int)
public T 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<T extends Serializable>
barr
- The byte
array containing the data.offset
- The start position of the data.length
- The length of the data.
Serializer.interpret(byte[])
public byte[] serialize(T o)
Serializer
byte
array.
serialize
in interface Serializer<T extends Serializable>
o
- The object to serialize.
byte
array.public int serialize(T o, byte[] barr, int offset)
Serializer
byte
array.
serialize
in interface Serializer<T extends Serializable>
o
- 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 T read(RandomAccess ra, int size)
Serializer
RandomAccess
' current position. The
position in the RandomAccess
is incremented by size
bytes.
read
in interface Serializer<T extends Serializable>
ra
- The RandomAccess
to read from.size
- The size of the value.
public T read(InputStream is, int size)
Serializer
InputStream
.
read
in interface Serializer<T extends Serializable>
is
- The InputStream
to read from.size
- The size of the value.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |