public class DeflatedJavaSerializer extends JavaSerializer
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()));
Constructor and Description |
---|
DeflatedJavaSerializer(String applicationKey)
Construct.
|
Modifier and Type | Method and Description |
---|---|
protected Deflater |
createDeflater()
Creates the
Deflater . |
protected ObjectInputStream |
newObjectInputStream(InputStream in)
Gets a new instance of an
ObjectInputStream with the provided InputStream . |
protected ObjectOutputStream |
newObjectOutputStream(OutputStream out)
Gets a new instance of an
ObjectOutputStream with the provided OutputStream . |
deserialize, serialize
public DeflatedJavaSerializer(String applicationKey)
applicationKey
- protected ObjectOutputStream newObjectOutputStream(OutputStream out) throws IOException
JavaSerializer
ObjectOutputStream
with the provided OutputStream
.newObjectOutputStream
in class JavaSerializer
out
- The output stream that should be used for the writingIOException
- if an I/O error occurs while writing stream headerprotected Deflater createDeflater()
Deflater
. Override this method to customize the deflater, for example to
change the compression level and/or strategy.Deflater
protected ObjectInputStream newObjectInputStream(InputStream in) throws IOException
JavaSerializer
ObjectInputStream
with the provided InputStream
.newObjectInputStream
in class JavaSerializer
in
- The input stream that should be used for the readingIOException
- if an I/O error occurs while reading stream headerCopyright © 2006–2021 Apache Software Foundation. All rights reserved.