Modifier and Type | Field and Description |
---|---|
protected com.esotericsoftware.kryo.pool.KryoPool |
pool |
Modifier | Constructor and Description |
---|---|
protected |
AbstractKryoCodec() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
configureKryoInstance(com.esotericsoftware.kryo.Kryo kryo)
Subclasses implement this to configure the kryo instance.
|
<T> T |
decode(byte[] bytes,
Class<T> type)
Decode an object of a given type
|
<T> T |
decode(InputStream inputStream,
Class<T> type)
Decode an object of a given type
|
protected abstract <T> T |
doDecode(com.esotericsoftware.kryo.Kryo kryo,
com.esotericsoftware.kryo.io.Input input,
Class<T> type)
Subclasses implement this method to decode with Kryo.
|
protected abstract void |
doEncode(com.esotericsoftware.kryo.Kryo kryo,
Object object,
com.esotericsoftware.kryo.io.Output output)
Subclasses implement this method to encode with Kryo.
|
byte[] |
encode(Object object)
Encode an object to a byte array
|
void |
encode(Object object,
OutputStream outputStream)
Encode (encode) an object to an OutputStream
|
public void encode(Object object, OutputStream outputStream)
Codec
public <T> T decode(byte[] bytes, Class<T> type) throws IOException
Codec
decode
in interface Codec
T
- the object's typebytes
- the byte array containing the encoded objecttype
- the object's classIOException
- if the operation failspublic <T> T decode(InputStream inputStream, Class<T> type)
Codec
public byte[] encode(Object object) throws IOException
Codec
encode
in interface Codec
object
- the object to encodeIOException
- if the operation failsprotected abstract void doEncode(com.esotericsoftware.kryo.Kryo kryo, Object object, com.esotericsoftware.kryo.io.Output output)
kryo
- the Kryo instanceobject
- the object to encodeoutput
- the Kryo Output instanceprotected abstract <T> T doDecode(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input, Class<T> type)
T
- the type for decoded objectkryo
- the Kryo instanceinput
- the Kryo Input instancetype
- the class of the decoded objectprotected abstract void configureKryoInstance(com.esotericsoftware.kryo.Kryo kryo)
kryo
- the Kryo instance