public interface Serializer
Modifier and Type | Method and Description |
---|---|
<T> T |
copy(T object)
Copies the specified object.
|
<T> T |
decode(byte[] bytes)
Deserialize the specified bytes.
|
<T> byte[] |
encode(T object)
Serialize the specified object.
|
static Serializer |
forTypes(java.lang.Class<?>... classes) |
static Serializer |
using(KryoNamespace kryo)
Creates a new Serializer instance from a KryoNamespace.
|
static Serializer |
using(KryoNamespace namespace,
java.lang.Class<?>... classes)
Creates a new Serializer instance from a KryoNamespace and some additional classes.
|
static Serializer |
using(java.util.List<KryoNamespace> namespaces,
java.lang.Class<?>... classes)
Creates a new Serializer instance from a list of KryoNamespaces and some additional classes.
|
<T> byte[] encode(T object)
T
- encoded typeobject
- object to serialize.<T> T decode(byte[] bytes)
T
- decoded typebytes
- byte array to deserialize.<T> T copy(T object)
T
- object typeobject
- object to copy.static Serializer using(KryoNamespace kryo)
kryo
- kryo namespacestatic Serializer using(KryoNamespace namespace, java.lang.Class<?>... classes)
namespace
- kryo namespaceclasses
- variable length array of classes to registerstatic Serializer using(java.util.List<KryoNamespace> namespaces, java.lang.Class<?>... classes)
namespaces
- kryo namespacesclasses
- variable length array of classes to registerstatic Serializer forTypes(java.lang.Class<?>... classes)