public final class KryoNamespace extends Object implements com.esotericsoftware.kryo.pool.KryoFactory, com.esotericsoftware.kryo.pool.KryoPool
| Modifier and Type | Class and Description |
|---|---|
static class |
KryoNamespace.Builder
KryoNamespace builder.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BUFFER_SIZE
Default buffer size used for serialization.
|
static int |
FLOATING_ID
ID to use if this KryoNamespace does not define registration id.
|
static int |
INITIAL_ID
Smallest ID free to use for user defined registrations.
|
static int |
MAX_BUFFER_SIZE |
| Modifier and Type | Method and Description |
|---|---|
com.esotericsoftware.kryo.Kryo |
borrow() |
com.esotericsoftware.kryo.Kryo |
create()
Creates a Kryo instance.
|
<T> T |
deserialize(byte[] bytes)
Deserializes given byte array to Object using Kryo instance in pool.
|
<T> T |
deserialize(ByteBuffer buffer)
Deserializes given byte buffer to Object using Kryo instance in pool.
|
<T> T |
deserialize(InputStream stream)
Deserializes given InputStream to an Object using Kryo instance in pool.
|
<T> T |
deserialize(InputStream stream,
int bufferSize)
Deserializes given InputStream to an Object using Kryo instance in pool.
|
static KryoNamespace.Builder |
newBuilder()
Creates a new
KryoNamespace builder. |
KryoNamespace |
populate(int instances)
Populates the Kryo pool.
|
void |
release(com.esotericsoftware.kryo.Kryo kryo) |
<T> T |
run(com.esotericsoftware.kryo.pool.KryoCallback<T> callback) |
byte[] |
serialize(Object obj)
Serializes given object to byte array using Kryo instance in pool.
|
void |
serialize(Object obj,
ByteBuffer buffer)
Serializes given object to byte buffer using Kryo instance in pool.
|
byte[] |
serialize(Object obj,
int bufferSize)
Serializes given object to byte array using Kryo instance in pool.
|
void |
serialize(Object obj,
OutputStream stream)
Serializes given object to OutputStream using Kryo instance in pool.
|
void |
serialize(Object obj,
OutputStream stream,
int bufferSize)
Serializes given object to OutputStream using Kryo instance in pool.
|
String |
toString() |
public static final int DEFAULT_BUFFER_SIZE
serialize(Object),
Constant Field Valuespublic static final int MAX_BUFFER_SIZE
public static final int FLOATING_ID
public static final int INITIAL_ID
public static KryoNamespace.Builder newBuilder()
KryoNamespace builder.public KryoNamespace populate(int instances)
instances - to add to the poolpublic byte[] serialize(Object obj)
Note: Serialized bytes must be smaller than MAX_BUFFER_SIZE.
obj - Object to serializepublic byte[] serialize(Object obj, int bufferSize)
obj - Object to serializebufferSize - maximum size of serialized bytespublic void serialize(Object obj, ByteBuffer buffer)
obj - Object to serializebuffer - to write topublic void serialize(Object obj, OutputStream stream)
obj - Object to serializestream - to write topublic void serialize(Object obj, OutputStream stream, int bufferSize)
obj - Object to serializestream - to write tobufferSize - size of the buffer in front of the streampublic <T> T deserialize(byte[] bytes)
T - deserialized Object typebytes - serialized bytespublic <T> T deserialize(ByteBuffer buffer)
T - deserialized Object typebuffer - input with serialized bytespublic <T> T deserialize(InputStream stream)
T - deserialized Object typestream - input streampublic <T> T deserialize(InputStream stream, int bufferSize)
T - deserialized Object typestream - input streambufferSize - size of the buffer in front of the streampublic com.esotericsoftware.kryo.Kryo create()
create in interface com.esotericsoftware.kryo.pool.KryoFactorypublic com.esotericsoftware.kryo.Kryo borrow()
borrow in interface com.esotericsoftware.kryo.pool.KryoPoolpublic void release(com.esotericsoftware.kryo.Kryo kryo)
release in interface com.esotericsoftware.kryo.pool.KryoPoolpublic <T> T run(com.esotericsoftware.kryo.pool.KryoCallback<T> callback)
run in interface com.esotericsoftware.kryo.pool.KryoPoolCopyright © 2016. All rights reserved.