Class CompressingSerializer
java.lang.Object
org.apache.commons.jcs3.utils.serialization.StandardSerializer
org.apache.commons.jcs3.utils.serialization.CompressingSerializer
- All Implemented Interfaces:
IElementSerializer
Performs default serialization and de-serialization. It gzips the value.
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorCompressingSerializer
(IElementSerializer serializer) Wrapper constructor -
Method Summary
Modifier and TypeMethodDescription<T> T
deSerialize
(byte[] data, ClassLoader loader) Uses default de-serialization to turn a byte array into an object.<T> byte[]
serialize
(T obj) Serializes an object using default serialization.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.commons.jcs3.engine.behavior.IElementSerializer
deSerializeFrom, deSerializeFrom, deSerializeFrom, serializeTo, serializeTo, serializeTo
-
Constructor Details
-
CompressingSerializer
public CompressingSerializer()Default constructor -
CompressingSerializer
Wrapper constructor- Parameters:
serializer
- the wrapped serializer- Since:
- 3.1
-
-
Method Details
-
serialize
Serializes an object using default serialization. Compresses the byte array.- Specified by:
serialize
in interfaceIElementSerializer
- Overrides:
serialize
in classStandardSerializer
- Type Parameters:
T
- the type of the object- Parameters:
obj
- object- Returns:
- byte[]
- Throws:
IOException
- on i/o problem
-
deSerialize
public <T> T deSerialize(byte[] data, ClassLoader loader) 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 interfaceIElementSerializer
- Overrides:
deSerialize
in classStandardSerializer
- Parameters:
data
- data bytesloader
- class loader to use- Returns:
- Object
- Throws:
IOException
- on i/o problemClassNotFoundException
- if class is not found during deserialization
-