Class JavaSerializationCopier

  • All Implemented Interfaces:
    Copier

    public class JavaSerializationCopier
    extends AbstractCopier<byte[]>
    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.

    • Constructor Detail

      • JavaSerializationCopier

        public JavaSerializationCopier()
    • Method Detail

      • serialize

        protected byte[] serialize​(Object object)
        Description copied from class: AbstractCopier
        Serializes the object.
        Specified by:
        serialize in class AbstractCopier<byte[]>
        Parameters:
        object - the object to serialize
        Returns:
        the serialized bytes
      • deserialize

        protected Object deserialize​(byte[] data,
                                     ClassLoader classLoader)
        Description copied from class: AbstractCopier
        Deserializes the data using the provided classloader.
        Specified by:
        deserialize in class AbstractCopier<byte[]>
        Parameters:
        data - the serialized bytes
        classLoader - the classloader to create the instance with
        Returns:
        the deserialized object