Class DefaultCoder
java.lang.Object
org.nustaq.serialization.simpleapi.DefaultCoder
- All Implemented Interfaces:
FSTCoder
- Direct Known Subclasses:
MinBinCoder
Created by ruedi on 09.11.14.
Encodes Objects to byte arrays and vice versa using slight value compression and a platform neutral data
layout (no diff regarding big/little endian). Implementation is conservative (no unsafe)
As this makes use of the stream oriented API, operation is not zero copy. However this is not too significant
compared to cost of serialization.
KEEP and reuse instances, creation is expensive.
This class cannot be used concurrently.
Works similar to the unsafe coders, but does not use Unsafe. Note that reading and writing
coder must match each other in type and configuration.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDefaultCoder
(boolean shared, Class... toPreRegister) DefaultCoder
(Class... preregister) -
Method Summary
Modifier and TypeMethodDescriptiongetConf()
byte[]
int
toByteArray
(Object obj, byte[] result, int resultOffset, int avaiableSize) will throw an FSTBufferTooSmallException if buffer is too small.toObject
(byte[] arr) toObject
(byte[] arr, int off, int len)
-
Field Details
-
conf
-
-
Constructor Details
-
DefaultCoder
-
DefaultCoder
-
DefaultCoder
public DefaultCoder()
-
-
Method Details
-
toByteArray
will throw an FSTBufferTooSmallException if buffer is too small.- Specified by:
toByteArray
in interfaceFSTCoder
-
toByteArray
- Specified by:
toByteArray
in interfaceFSTCoder
-
getConf
-
toObject
-
toObject
-