Class AbstractKryoCodec
java.lang.Object
org.springframework.integration.codec.kryo.AbstractKryoCodec
- All Implemented Interfaces:
Codec
- Direct Known Subclasses:
PojoCodec
public abstract class AbstractKryoCodec extends Object implements Codec
- Since:
- 4.2
- Author:
- David Turanski
-
Field Summary
Fields Modifier and Type Field Description protected com.esotericsoftware.kryo.pool.KryoPoolpool -
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractKryoCodec() -
Method Summary
Modifier and Type Method Description protected abstract voidconfigureKryoInstance(com.esotericsoftware.kryo.Kryo kryo)Subclasses implement this to configure the kryo instance.<T> Tdecode(byte[] bytes, Class<T> type)Decode an object of a given type<T> Tdecode(InputStream inputStream, Class<T> type)Decode an object of a given typeprotected abstract <T> TdoDecode(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input, Class<T> type)Subclasses implement this method to decode with Kryo.protected abstract voiddoEncode(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 arrayvoidencode(Object object, OutputStream outputStream)Encode (encode) an object to an OutputStream
-
Field Details
-
pool
protected final com.esotericsoftware.kryo.pool.KryoPool pool
-
-
Constructor Details
-
AbstractKryoCodec
protected AbstractKryoCodec()
-
-
Method Details
-
encode
Description copied from interface:CodecEncode (encode) an object to an OutputStream -
decode
Description copied from interface:CodecDecode an object of a given type- Specified by:
decodein interfaceCodec- Type Parameters:
T- the object's type- Parameters:
bytes- the byte array containing the encoded objecttype- the object's class- Returns:
- the object
- Throws:
IOException- if the operation fails
-
decode
Description copied from interface:CodecDecode an object of a given type -
encode
Description copied from interface:CodecEncode an object to a byte array- Specified by:
encodein interfaceCodec- Parameters:
object- the object to encode- Returns:
- the bytes
- Throws:
IOException- if the operation fails
-
doEncode
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.- Parameters:
kryo- the Kryo instanceobject- the object to encodeoutput- the Kryo Output instance
-
doDecode
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.- Type Parameters:
T- the type for decoded object- Parameters:
kryo- the Kryo instanceinput- the Kryo Input instancetype- the class of the decoded object- Returns:
- the decoded object
-
configureKryoInstance
protected abstract void configureKryoInstance(com.esotericsoftware.kryo.Kryo kryo)Subclasses implement this to configure the kryo instance. This is invoked on each new Kryo instance when it is created.- Parameters:
kryo- the Kryo instance
-