public abstract class Serializer
extends java.lang.Object
ByteBuffer
.Kryo.register(Class, Serializer)
Constructor and Description |
---|
Serializer() |
Modifier and Type | Method and Description |
---|---|
boolean |
isFinal(java.lang.Class type)
Returns true if the specified type is final, or if it is an array of a final type.
|
<T> T |
newInstance(Kryo kryo,
java.lang.Class<T> type)
Returns an instance of the specified class.
|
<T> T |
readObject(java.nio.ByteBuffer buffer,
java.lang.Class<T> type)
Reads an object from the buffer.
|
abstract <T> T |
readObjectData(java.nio.ByteBuffer buffer,
java.lang.Class<T> type)
Reads an object from the buffer.
|
void |
setCanBeNull(boolean canBeNull)
When true, a byte will not be used to denote if the object is null.
|
void |
writeObject(java.nio.ByteBuffer buffer,
java.lang.Object object)
Writes the object to the buffer.
|
abstract void |
writeObjectData(java.nio.ByteBuffer buffer,
java.lang.Object object)
Writes the object to the buffer.
|
public void setCanBeNull(boolean canBeNull)
public final void writeObject(java.nio.ByteBuffer buffer, java.lang.Object object)
object
- Can be null (writes a special class ID for a null object instead).public abstract void writeObjectData(java.nio.ByteBuffer buffer, java.lang.Object object)
object
- Cannot be null.public final <T> T readObject(java.nio.ByteBuffer buffer, java.lang.Class<T> type)
public abstract <T> T readObjectData(java.nio.ByteBuffer buffer, java.lang.Class<T> type)
public <T> T newInstance(Kryo kryo, java.lang.Class<T> type)
Kryo.newInstance(Class)
.SerializationException
- if the class could not be constructed.public boolean isFinal(java.lang.Class type)
Kryo.isFinal(Class)
, allowing a subclass to customize the behavior (eg, an application may decide that all
java.util.ArrayList instances should be considered final).