org.apache.jcs.utils.serialization
Class CompressingSerializer

java.lang.Object
  extended by org.apache.jcs.utils.serialization.CompressingSerializer
All Implemented Interfaces:
IElementSerializer

public class CompressingSerializer
extends Object
implements IElementSerializer

Performs default serialization and de-serialization. It gzips the value.


Constructor Summary
CompressingSerializer()
           
 
Method Summary
<T extends Serializable>
T
deSerialize(byte[] data)
          Uses default de-serialization to turn a byte array into an object.
protected
<T extends Serializable>
T
deserializeObject(byte[] decompressedByteArray)
          Does the standard deserialization.
<T extends Serializable>
byte[]
serialize(T obj)
          Serializes an object using default serialization.
protected
<T extends Serializable>
byte[]
serializeObject(T obj)
          Does the basic serialization.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompressingSerializer

public CompressingSerializer()
Method Detail

serialize

public <T extends Serializable> byte[] serialize(T obj)
                 throws IOException
Serializes an object using default serialization. Compresses the byte array.

Specified by:
serialize in interface IElementSerializer
Parameters:
obj - object
Returns:
byte[]
Throws:
IOException - on i/o problem

serializeObject

protected <T extends Serializable> byte[] serializeObject(T obj)
                          throws IOException
Does the basic serialization.

Parameters:
obj - object
Returns:
byte[]
Throws:
IOException - on i/o problem

deSerialize

public <T extends Serializable> T deSerialize(byte[] data)
                                   throws IOException,
                                          ClassNotFoundException
Uses default de-serialization to turn a byte array into an object. Decompresses the value first. All exceptions are converted into IOExceptions.

Specified by:
deSerialize in interface IElementSerializer
Parameters:
data - bytes of data
Returns:
Object
Throws:
IOException - on i/o problem
ClassNotFoundException - if class is not found during deserialization

deserializeObject

protected <T extends Serializable> T deserializeObject(byte[] decompressedByteArray)
                                            throws IOException,
                                                   ClassNotFoundException
Does the standard deserialization.

Parameters:
decompressedByteArray - array of decompressed bytes
Returns:
Object
Throws:
IOException - on i/o error
ClassNotFoundException - if class is not found during deserialization


Copyright © 2002-2013 The Apache Software Foundation. All Rights Reserved.