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
 Object deSerialize(byte[] data)
          Uses default de-serialization to turn a byte array into an object.
protected  Object deserializeObject(byte[] decompressedByteArray)
          Does the standard deserialization.
 byte[] serialize(Serializable obj)
          Serializes an object using default serilaization.
protected  byte[] serializeObject(Serializable 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 byte[] serialize(Serializable obj)
                 throws IOException
Serializes an object using default serilaization. Compresses the byte array.

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

serializeObject

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

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

deSerialize

public Object 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 Object 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-2012 Apache Software Foundation. All Rights Reserved.