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 class
An ObjectInputStream that instantiates using the supplied classloader. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Object
deserialize
(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:AbstractCopier
Serializes the object.- Specified by:
serialize
in classAbstractCopier<byte[]>
- Parameters:
object
- the object to serialize- Returns:
- the serialized bytes
-
deserialize
Description copied from class:AbstractCopier
Deserializes the data using the provided classloader.- Specified by:
deserialize
in classAbstractCopier<byte[]>
- Parameters:
data
- the serialized bytesclassLoader
- the classloader to create the instance with- Returns:
- the deserialized object
-