Class AbstractKryoCodec
java.lang.Object
org.springframework.integration.codec.kryo.AbstractKryoCodec
- All Implemented Interfaces:
Codec
- Direct Known Subclasses:
PojoCodec
public abstract class AbstractKryoCodec extends java.lang.Object implements Codec
- Since:
- 4.2
-
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, java.lang.Class<T> type)Decode an object of a given type<T> Tdecode(java.io.InputStream inputStream, java.lang.Class<T> type)Decode an object of a given typeprotected abstract <T> TdoDecode(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input, java.lang.Class<T> type)Subclasses implement this method to decode with Kryo.protected abstract voiddoEncode(com.esotericsoftware.kryo.Kryo kryo, java.lang.Object object, com.esotericsoftware.kryo.io.Output output)Subclasses implement this method to encode with Kryo.byte[]encode(java.lang.Object object)Encode an object to a byte arrayvoidencode(java.lang.Object object, java.io.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
public void encode(java.lang.Object object, java.io.OutputStream outputStream)Description copied from interface:CodecEncode (encode) an object to an OutputStream -
decode
public <T> T decode(byte[] bytes, java.lang.Class<T> type) throws java.io.IOExceptionDescription copied from interface:CodecDecode an object of a given type -
decode
public <T> T decode(java.io.InputStream inputStream, java.lang.Class<T> type)Description copied from interface:CodecDecode an object of a given type -
encode
public byte[] encode(java.lang.Object object) throws java.io.IOExceptionDescription copied from interface:CodecEncode an object to a byte array -
doEncode
protected abstract void doEncode(com.esotericsoftware.kryo.Kryo kryo, java.lang.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, java.lang.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
-