Class JavaSerializer

  • All Implemented Interfaces:
    ISerializer
    Direct Known Subclasses:
    DeflatedJavaSerializer

    public class JavaSerializer
    extends java.lang.Object
    implements ISerializer
    An implementation of ISerializer based on Java Serialization (ObjectOutputStream, ObjectInputStream) Requires the application key to enable serialization and deserialisation outside thread in which application thread local is set
    • Constructor Summary

      Constructors 
      Constructor Description
      JavaSerializer​(java.lang.String applicationKey)
      Construct.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object deserialize​(byte[] data)
      Reconstructs the object from its serialized state
      protected java.io.ObjectInputStream newObjectInputStream​(java.io.InputStream in)
      Gets a new instance of an ObjectInputStream with the provided InputStream.
      protected java.io.ObjectOutputStream newObjectOutputStream​(java.io.OutputStream out)
      Gets a new instance of an ObjectOutputStream with the provided OutputStream.
      byte[] serialize​(java.lang.Object object)
      Converts the object to byte array
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JavaSerializer

        public JavaSerializer​(java.lang.String applicationKey)
        Construct.
        Parameters:
        applicationKey - the name of the application
    • Method Detail

      • serialize

        public byte[] serialize​(java.lang.Object object)
        Description copied from interface: ISerializer
        Converts the object to byte array
        Specified by:
        serialize in interface ISerializer
        Parameters:
        object - the object to serialize
        Returns:
        the serialized page as byte array
      • deserialize

        public java.lang.Object deserialize​(byte[] data)
        Description copied from interface: ISerializer
        Reconstructs the object from its serialized state
        Specified by:
        deserialize in interface ISerializer
        Parameters:
        data - the serialized state of the object
        Returns:
        the object reconstructed from its serialized state
      • newObjectInputStream

        protected java.io.ObjectInputStream newObjectInputStream​(java.io.InputStream in)
                                                          throws java.io.IOException
        Gets a new instance of an ObjectInputStream with the provided InputStream.
        Parameters:
        in - The input stream that should be used for the reading
        Returns:
        a new object input stream instance
        Throws:
        java.io.IOException - if an I/O error occurs while reading stream header
      • newObjectOutputStream

        protected java.io.ObjectOutputStream newObjectOutputStream​(java.io.OutputStream out)
                                                            throws java.io.IOException
        Gets a new instance of an ObjectOutputStream with the provided OutputStream.
        Parameters:
        out - The output stream that should be used for the writing
        Returns:
        a new object output stream instance
        Throws:
        java.io.IOException - if an I/O error occurs while writing stream header