Class JavaSerializationCopier
java.lang.Object
com.github.benmanes.caffeine.jcache.copy.AbstractCopier<byte[]>
com.github.benmanes.caffeine.jcache.copy.JavaSerializationCopier
- All Implemented Interfaces:
Copier
A strategy that uses Java serialization if a fast path approach is not applicable.
Beware that native serialization is slow and is provided for completeness. In practice, it is recommended that a higher performance alternative is used, which is provided by numerous external libraries.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classAn ObjectInputStream that instantiates using the supplied classloader. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Objectdeserialize(byte[] data, ClassLoader classLoader) Deserializes the data using the provided classloader.protected byte[]Serializes the object.Methods inherited from class com.github.benmanes.caffeine.jcache.copy.AbstractCopier
canDeeplyCopy, copy, isImmutable, javaDeepCopyStrategies, javaImmutableClasses, roundtrip
-
Constructor Details
-
JavaSerializationCopier
public JavaSerializationCopier() -
JavaSerializationCopier
-
-
Method Details
-
serialize
Description copied from class:AbstractCopierSerializes the object.- Specified by:
serializein classAbstractCopier<byte[]>- Parameters:
object- the object to serialize- Returns:
- the serialized bytes
-
deserialize
Description copied from class:AbstractCopierDeserializes the data using the provided classloader.- Specified by:
deserializein classAbstractCopier<byte[]>- Parameters:
data- the serialized bytesclassLoader- the classloader to create the instance with- Returns:
- the deserialized object
-