Class NativeBuffer
java.lang.Object
org.fusesource.leveldbjni.internal.NativeObject
org.fusesource.leveldbjni.internal.NativeBuffer
A NativeBuffer allocates a native buffer on the heap. It supports
creating sub slices/views of that buffer and manages reference tracking
so that the the native buffer is freed once all NativeBuffer views
are deleted.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class(package private) static classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final NativeBuffer.Allocationprivate final longprivate static final ThreadLocal<NativeBuffer.Pool> Fields inherited from class org.fusesource.leveldbjni.internal.NativeObject
self -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateNativeBuffer(NativeBuffer.Allocation allocation, long self, long capacity) -
Method Summary
Modifier and TypeMethodDescriptionlongcapacity()(package private) static byte[]static NativeBuffercreate(byte[] data) static NativeBuffercreate(byte[] data, int offset, int length) static NativeBuffercreate(long capacity) static NativeBuffervoiddelete()head(long length) static voidstatic voidpushMemoryPool(int size) voidread(long at, byte[] target, int offset, int length) slice(long offset, long length) tail(long length) byte[]voidwrite(long at, byte[] source, int offset, int length) Methods inherited from class org.fusesource.leveldbjni.internal.NativeObject
assertAllocated, isAllocated, pointer
-
Field Details
-
allocation
-
capacity
private final long capacity -
CURRENT_POOL
-
-
Constructor Details
-
NativeBuffer
-
-
Method Details
-
create
-
pushMemoryPool
public static void pushMemoryPool(int size) -
popMemoryPool
public static void popMemoryPool() -
create
-
create
-
create
-
slice
-
cbytes
-
head
-
tail
-
delete
public void delete() -
capacity
public long capacity() -
write
public void write(long at, byte[] source, int offset, int length) -
read
public void read(long at, byte[] target, int offset, int length) -
toByteArray
public byte[] toByteArray()
-