public class BeanSerializer extends Serializer
FieldSerializer
but is much faster and more efficient than Java serialization. Bytecode
generation is used to invoke the bean propert methods, if possible.
BeanSerializer does not write header data, only the object data is stored. If the type of a bean property is not final (note primitives are final) then an extra byte is written for that property.
Serializer
,
Kryo.register(Class, Serializer)
Constructor and Description |
---|
BeanSerializer(Kryo kryo,
java.lang.Class type) |
Modifier and Type | Method and Description |
---|---|
<T> T |
readObjectData(java.nio.ByteBuffer buffer,
java.lang.Class<T> type)
Reads an object from the buffer.
|
void |
writeObjectData(java.nio.ByteBuffer buffer,
java.lang.Object object)
Writes the object to the buffer.
|
isFinal, newInstance, readObject, setCanBeNull, writeObject
public BeanSerializer(Kryo kryo, java.lang.Class type)
public void writeObjectData(java.nio.ByteBuffer buffer, java.lang.Object object)
Serializer
writeObjectData
in class Serializer
object
- Cannot be null.public <T> T readObjectData(java.nio.ByteBuffer buffer, java.lang.Class<T> type)
Serializer
readObjectData
in class Serializer