public class ByteArrayProxy extends BufferProxy<byte[]>
Env.create(org.lmdbjava.BufferProxy)
.Modifier and Type | Field and Description |
---|---|
static BufferProxy<byte[]> |
PROXY_BA
The byte array proxy.
|
MDB_VAL_STRUCT_SIZE, STRUCT_FIELD_OFFSET_DATA, STRUCT_FIELD_OFFSET_SIZE
Constructor and Description |
---|
ByteArrayProxy() |
Modifier and Type | Method and Description |
---|---|
protected byte[] |
allocate()
Allocate a new buffer suitable for passing to
BufferProxy.out(java.lang.Object, jnr.ffi.Pointer, long) . |
protected int |
compare(byte[] o1,
byte[] o2)
Compare the two buffers.
|
static int |
compareArrays(byte[] o1,
byte[] o2)
Lexicographically compare two byte arrays.
|
protected void |
deallocate(byte[] buff)
Deallocate a buffer that was previously provided by
BufferProxy.allocate() . |
protected byte[] |
getBytes(byte[] buffer)
Obtain a copy of the bytes contained within the passed buffer.
|
protected void |
in(byte[] 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(byte[] buffer,
jnr.ffi.Pointer ptr,
long ptrAddr)
Called when the
MDB_val should be set to reflect the passed
buffer. |
protected byte[] |
out(byte[] 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<byte[]> PROXY_BA
public static int compareArrays(byte[] o1, byte[] o2)
o1
- left operand (required)o2
- right operand (required)Comparable
interfaceprotected final byte[] allocate()
BufferProxy
BufferProxy.out(java.lang.Object, jnr.ffi.Pointer, long)
.allocate
in class BufferProxy<byte[]>
out
methodprotected final int compare(byte[] o1, byte[] 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<byte[]>
o1
- left operando2
- right operandComparable
protected final void deallocate(byte[] buff)
BufferProxy
BufferProxy.allocate()
.deallocate
in class BufferProxy<byte[]>
buff
- the buffer to deallocate (required)protected final byte[] getBytes(byte[] buffer)
BufferProxy
getBytes
in class BufferProxy<byte[]>
buffer
- a non-null buffer created by this proxy instanceprotected final void in(byte[] 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<byte[]>
buffer
- the buffer to write to MDB_val
ptr
- the pointer to the MDB_val
ptrAddr
- the address of the MDB_val
pointerprotected final void in(byte[] buffer, int size, jnr.ffi.Pointer ptr, long ptrAddr)
BufferProxy
MDB_val
should be set to reflect the passed
buffer.in
in class BufferProxy<byte[]>
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 final byte[] out(byte[] 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<byte[]>
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.