Class OffHeapCoder
java.lang.Object
org.nustaq.serialization.simpleapi.OffHeapCoder
Created by ruedi on 09.11.14.
enables zero copy encoding to offheap memory. The encoding is platform dependent (endianess) and
no attemps on compression are made.
Use case: messaging, offheap en/decoding, tmp preservation of state
NOT thread safe
Future version may choose to operate on DirectByteBuffer in case unsafe class vanishes
Do not confuse this with a stream. Each single writeObject is an isolated operation,
so restoring of references inside an object graph only happens for refs inside the object graph
given to writeObject.
***********************************************************************
USE ONLY IF DEFAULTCODER (no unsafe) HAS BEEN PROVEN TO SLOW YOU DOWN.
***********************************************************************
Note this does not satisfy the FSTCoder interface. Its purely targeted to directly read/write native memory
allocates using unsafe.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionOffHeapCoder
(boolean sharedRefs) OffHeapCoder
(boolean sharedRefs, Class... preregister) throwOffHeapCoder
(Class... preregister) -
Method Summary
-
Field Details
-
conf
-
-
Constructor Details
-
OffHeapCoder
public OffHeapCoder() -
OffHeapCoder
public OffHeapCoder(boolean sharedRefs) -
OffHeapCoder
throw- Parameters:
preregister
-
-
OffHeapCoder
-
-
Method Details
-
toMemory
throws FSTBufferTooSmallException in case object does not fit into given range- Parameters:
o
-address
-availableSize
-- Returns:
- number of bytes written to the memory region
- Throws:
IOException
-
toObject
- Throws:
IOException
ClassNotFoundException
-