public final class DirectBufferProxy extends BufferProxy<org.agrona.DirectBuffer>
DirectBuffer
.
This class requires UnsafeAccess
and Agrona must be in the classpath.
Modifier and Type | Field and Description |
---|---|
static BufferProxy<org.agrona.DirectBuffer> |
PROXY_DB
The
MutableDirectBuffer proxy. |
MDB_VAL_STRUCT_SIZE, STRUCT_FIELD_OFFSET_DATA, STRUCT_FIELD_OFFSET_SIZE
Constructor and Description |
---|
DirectBufferProxy() |
Modifier and Type | Method and Description |
---|---|
protected org.agrona.DirectBuffer |
allocate()
Allocate a new buffer suitable for passing to
BufferProxy.out(java.lang.Object, jnr.ffi.Pointer, long) . |
protected int |
compare(org.agrona.DirectBuffer o1,
org.agrona.DirectBuffer o2)
Compare the two buffers.
|
static int |
compareBuff(org.agrona.DirectBuffer o1,
org.agrona.DirectBuffer o2)
Lexicographically compare two buffers.
|
protected void |
deallocate(org.agrona.DirectBuffer buff)
Deallocate a buffer that was previously provided by
BufferProxy.allocate() . |
protected byte[] |
getBytes(org.agrona.DirectBuffer buffer)
Obtain a copy of the bytes contained within the passed buffer.
|
protected void |
in(org.agrona.DirectBuffer buffer,
int size,
jnr.ffi.Pointer ptr,
long ptrAddr)
Called when the
MDB_val should be set to reflect the passed
buffer. |
protected void |
in(org.agrona.DirectBuffer buffer,
jnr.ffi.Pointer ptr,
long ptrAddr)
Called when the
MDB_val should be set to reflect the passed
buffer. |
protected org.agrona.DirectBuffer |
out(org.agrona.DirectBuffer buffer,
jnr.ffi.Pointer ptr,
long ptrAddr)
Called when the
MDB_val may have changed and the passed buffer
should be modified to reflect the new MDB_val . |
public static final BufferProxy<org.agrona.DirectBuffer> PROXY_DB
MutableDirectBuffer
proxy. Guaranteed to never be null,
although a class initialization exception will occur if an attempt is made
to access this field when unsafe or Agrona is unavailable.public static int compareBuff(org.agrona.DirectBuffer o1, org.agrona.DirectBuffer o2)
o1
- left operand (required)o2
- right operand (required)Comparable
interfaceprotected org.agrona.DirectBuffer allocate()
BufferProxy
BufferProxy.out(java.lang.Object, jnr.ffi.Pointer, long)
.allocate
in class BufferProxy<org.agrona.DirectBuffer>
out
methodprotected int compare(org.agrona.DirectBuffer o1, org.agrona.DirectBuffer o2)
BufferProxy
Implemented as a protected method to discourage use of the buffer proxy in collections etc (given by design it wraps a temporary value only).
compare
in class BufferProxy<org.agrona.DirectBuffer>
o1
- left operando2
- right operandComparable
protected void deallocate(org.agrona.DirectBuffer buff)
BufferProxy
BufferProxy.allocate()
.deallocate
in class BufferProxy<org.agrona.DirectBuffer>
buff
- the buffer to deallocate (required)protected byte[] getBytes(org.agrona.DirectBuffer buffer)
BufferProxy
getBytes
in class BufferProxy<org.agrona.DirectBuffer>
buffer
- a non-null buffer created by this proxy instanceprotected void in(org.agrona.DirectBuffer buffer, jnr.ffi.Pointer ptr, long ptrAddr)
BufferProxy
MDB_val
should be set to reflect the passed
buffer. This buffer will have been created by end users, not
BufferProxy.allocate()
.in
in class BufferProxy<org.agrona.DirectBuffer>
buffer
- the buffer to write to MDB_val
ptr
- the pointer to the MDB_val
ptrAddr
- the address of the MDB_val
pointerprotected void in(org.agrona.DirectBuffer buffer, int size, jnr.ffi.Pointer ptr, long ptrAddr)
BufferProxy
MDB_val
should be set to reflect the passed
buffer.in
in class BufferProxy<org.agrona.DirectBuffer>
buffer
- the buffer to write to MDB_val
size
- the buffer size to write to MDB_val
ptr
- the pointer to the MDB_val
ptrAddr
- the address of the MDB_val
pointerprotected org.agrona.DirectBuffer out(org.agrona.DirectBuffer buffer, jnr.ffi.Pointer ptr, long ptrAddr)
BufferProxy
MDB_val
may have changed and the passed buffer
should be modified to reflect the new MDB_val
.out
in class BufferProxy<org.agrona.DirectBuffer>
buffer
- the buffer to write to MDB_val
ptr
- the pointer to the MDB_val
ptrAddr
- the address of the MDB_val
pointerMDB_val
Copyright © 2016–2018 The LmdbJava Open Source Project. All rights reserved.