Class DeflatedJavaSerializer

  • All Implemented Interfaces:
    ISerializer

    public class DeflatedJavaSerializer
    extends JavaSerializer
    A JavaSerializer that deflates the outputstream on the fly, reducing page store size by up to a factor 8. Be advised that deflating serialized objects comes at a price of about 2-20ms per page request, depending on the size of the page and the cpu power of the machine.

    To use this serializer, put the following code in your application's init:

     getFrameworkSettings().setSerializer(new DeflatedJavaSerializer(getApplicationKey()));
     
    Author:
    papegaaij
    • Constructor Summary

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.util.zip.Deflater createDeflater()
      Creates the Deflater.
      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.
      • Methods inherited from class java.lang.Object

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

      • DeflatedJavaSerializer

        public DeflatedJavaSerializer​(java.lang.String applicationKey)
        Construct.
        Parameters:
        applicationKey -
    • Method Detail

      • newObjectOutputStream

        protected java.io.ObjectOutputStream newObjectOutputStream​(java.io.OutputStream out)
                                                            throws java.io.IOException
        Description copied from class: JavaSerializer
        Gets a new instance of an ObjectOutputStream with the provided OutputStream.
        Overrides:
        newObjectOutputStream in class JavaSerializer
        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
      • createDeflater

        protected java.util.zip.Deflater createDeflater()
        Creates the Deflater. Override this method to customize the deflater, for example to change the compression level and/or strategy.
        Returns:
        the Deflater
      • newObjectInputStream

        protected java.io.ObjectInputStream newObjectInputStream​(java.io.InputStream in)
                                                          throws java.io.IOException
        Description copied from class: JavaSerializer
        Gets a new instance of an ObjectInputStream with the provided InputStream.
        Overrides:
        newObjectInputStream in class JavaSerializer
        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