Class JsonLzfCodec
java.lang.Object
com.github.cafapi.common.codecs.jsonlzf.JsonLzfCodec
Implementation of Codec that supports serialisation and deserialisation to and form JSON format that itself is compressed with a
high-speed LZF algorithm. In some crude tests, this was resulting in data that was approximately 60% of the original JSON size with
negligible performance impact.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> T
deserialise
(byte[] data, Class<T> clazz, DecodeMethod method) Deserialise the given data into the specified class.<T> T
deserialise
(InputStream stream, Class<T> clazz, DecodeMethod method) Deserialise the given data into the specified class using the default decode method.protected com.fasterxml.jackson.databind.ObjectMapper
getMapper
(DecodeMethod method) byte[]
Serialise the given object into a byte data form.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.github.cafapi.common.api.Codec
deserialise, deserialise
-
Constructor Details
-
JsonLzfCodec
public JsonLzfCodec()
-
-
Method Details
-
deserialise
Description copied from interface:Codec
Deserialise the given data into the specified class.- Specified by:
deserialise
in interfaceCodec
- Type Parameters:
T
- the class the serialised data represents- Parameters:
data
- the serialised dataclazz
- the class the serialised data representsmethod
- specifies whether to use strict or lenient decoding during deserialisation- Returns:
- an instance of the class specified represented by the data
- Throws:
CodecException
- if the data could not be deserialised
-
deserialise
public <T> T deserialise(InputStream stream, Class<T> clazz, DecodeMethod method) throws CodecException Description copied from interface:Codec
Deserialise the given data into the specified class using the default decode method.- Specified by:
deserialise
in interfaceCodec
- Type Parameters:
T
- the class the serialised data represents- Parameters:
stream
- the serialised data as a streamclazz
- the class the serialised data representsmethod
- specifies whether to use strict or lenient decoding during deserialisation- Returns:
- an instance of the class specified represented by the data
- Throws:
CodecException
- if the data could not be deserialised
-
serialise
Description copied from interface:Codec
Serialise the given object into a byte data form.- Specified by:
serialise
in interfaceCodec
- Parameters:
object
- the object to serialise- Returns:
- the serialised data of the given object
- Throws:
CodecException
- if the object could not be serialised
-
getMapper
-