public class APIBuffer
extends java.lang.Object
Constructor and Description |
---|
APIBuffer() |
Modifier and Type | Method and Description |
---|---|
long |
address()
Returns the memory address of the internal
ByteBuffer . |
long |
address(int offset)
Returns the memory address of the specified
offset . |
long |
addressSafe(java.lang.Object value,
int offset)
Returns the memory address of the specified
offset or
NULL if the specified value is null. |
int |
booleanParam()
Ensures space for an additional boolean value and returns the address
offset.
|
int |
booleanParam(boolean value)
Ensures space for an additional boolean value, sets the specified value
at the allocated offset and returns that offset.
|
boolean |
booleanValue(int offset)
Returns the boolean value at the specified offset.
|
java.nio.ByteBuffer |
buffer()
Returns the
ByteBuffer that backs this APIBuffer . |
int |
bufferParam(int size)
Ensures space for an additional buffer with the specified size (in bytes)
and returns the address offset.
|
int |
byteParam()
Ensures space for an additional byte value and returns the address
offset.
|
int |
byteParam(byte value)
Ensures space for an additional byte value, sets the specified value at
the allocated offset and returns that offset.
|
byte |
byteValue(int offset)
Returns the boolean value at the specified offset.
|
int |
doubleParam()
Ensures space for an additional double value and returns the address
offset.
|
int |
doubleParam(double value)
Ensures space for an additional double value, sets the specified value at
the allocated offset and returns that offset.
|
double |
doubleValue(int offset)
Returns the double value at the specified offset.
|
int |
floatParam()
Ensures space for an additional float value and returns the address
offset.
|
int |
floatParam(float value)
Ensures space for an additional float value, sets the specified value at
the allocated offset and returns that offset.
|
float |
floatValue(int offset)
Returns the float value at the specified offset.
|
int |
getOffset()
Returns the current parameter offset.
|
int |
intParam()
Ensures space for an additional int value and returns the address offset.
|
int |
intParam(int value)
Ensures space for an additional int value, sets the specified value at
the allocated offset and returns that offset.
|
void |
intParam(int offset,
int index,
int value)
Sets an int value at the specified index of the int buffer that starts at
the specified offset.
|
int |
intValue(int offset)
Returns the int value at the specified offset.
|
int |
longParam()
Ensures space for an additional long value and returns the address
offset.
|
int |
longParam(long value)
Ensures space for an additional long value, sets the specified value at
the allocated offset and returns that offset.
|
long |
longValue(int offset)
Returns the long value at the specified offset.
|
void |
pointerArrayFree(int offset,
int length)
Frees
length memory blocks stored in the APIBuffer, starting at
the specified offset . |
int |
pointerArrayParam(java.nio.ByteBuffer... buffers)
Ensures space for an additional pointer buffer, sets the memory addresses
of the specified buffers and returns the address offset.
|
int |
pointerArrayParam(long... pointers)
Ensures space for an additional pointer buffer, sets the specified memory
addresses and returns the address offset.
|
int |
pointerArrayParamASCII(java.lang.CharSequence... strings)
ASCII encodes the specified strings with a null-terminator and ensures
space for a buffer filled with the memory addresses of the encoded
strings.
|
int |
pointerArrayParamASCIIi(java.lang.CharSequence... strings)
ASCII encodes the specified strings and ensures space for two additional
buffers filled with the lengths and memory addresses of the encoded
strings, respectively.
|
int |
pointerArrayParamASCIIp(java.lang.CharSequence... strings)
ASCII encodes the specified strings and ensures space for two additional
buffers filled with the lengths and memory addresses of the encoded
strings, respectively.
|
int |
pointerArrayParamp(java.nio.ByteBuffer... buffers)
Ensures space for two additional pointer buffers, sets the memory
addresses and remaining bytes of the specified buffers and returns the
address offset.
|
int |
pointerArrayParamUTF16(java.lang.CharSequence... strings)
UTF16 encodes the specified strings with a null-terminator and ensures
space for a buffer filled with the memory addresses of the encoded
strings.
|
int |
pointerArrayParamUTF16i(java.lang.CharSequence... strings)
UTF16 encodes the specified strings and ensures space for two additional
buffers filled with the lengths and memory addresses of the encoded
strings, respectively.
|
int |
pointerArrayParamUTF16p(java.lang.CharSequence... strings)
UTF16 encodes the specified strings and ensures space for two additional
buffers filled with the lengths and memory addresses of the encoded
strings, respectively.
|
int |
pointerArrayParamUTF8(java.lang.CharSequence... strings)
UTF8 encodes the specified strings with a null-terminator and ensures
space for a buffer filled with the memory addresses of the encoded
strings.
|
int |
pointerArrayParamUTF8i(java.lang.CharSequence... strings)
UTF8 encodes the specified strings and ensures space for two additional
buffers filled with the lengths and memory addresses of the encoded
strings, respectively.
|
int |
pointerArrayParamUTF8p(java.lang.CharSequence... strings)
UTF8 encodes the specified strings and ensures space for two additional
buffers filled with the lengths and memory addresses of the encoded
strings, respectively.
|
int |
pointerParam()
Ensures space for an additional pointer value and returns the address
offset.
|
void |
pointerParam(int offset,
int index,
long value)
Sets a pointer value at the specified index of the pointer buffer that
starts at the specified offset.
|
int |
pointerParam(long value)
Ensures space for an additional pointer value, sets the specified value
at the allocated offset and returns that offset.
|
long |
pointerValue(int offset)
Returns the pointer value at the specified offset.
|
APIBuffer |
pop()
Restores the last pushed parameter offset.
|
APIBuffer |
push()
Pushes the current parameter offset to a stack.
|
APIBuffer |
reset()
Resets the parameter offset to 0.
|
void |
setOffset(int offset)
Sets the current parameter offset.
|
int |
shortParam()
Ensures space for an additional short value and returns the address
offset.
|
int |
shortParam(short value)
Ensures space for an additional short value, sets the specified value at
the allocated offset and returns that offset.
|
short |
shortValue(int offset)
Returns the short value at the specified offset.
|
int |
stringParamASCII(java.lang.CharSequence value,
boolean nullTerminated)
Ensures space for the specified string encoded in ASCII, encodes the
string at the allocated offset and returns that offset.
|
int |
stringParamUTF16(java.lang.CharSequence value,
boolean nullTerminated)
Ensures space for the specified string encoded in UTF-16, encodes the
string at the allocated offset and returns that offset.
|
int |
stringParamUTF8(java.lang.CharSequence value,
boolean nullTerminated)
Ensures space for the specified string encoded in UTF-8, encodes the
string at the allocated offset and returns that offset.
|
java.lang.String |
stringValueASCII(int offset,
int limit)
Returns the ASCII string value at the specified byte range.
|
java.lang.String |
stringValueUTF16(int offset,
int limit)
Returns the UTF16 string value at the specified byte range.
|
java.lang.String |
stringValueUTF8(int offset,
int limit)
Returns the UTF8 string value at the specified byte range.
|
public APIBuffer reset()
public APIBuffer push()
public APIBuffer pop()
public int getOffset()
public void setOffset(int offset)
public long address()
ByteBuffer
. This
address may change after a call to one of the <type>Param()
methods.public long address(int offset)
offset
. This address
may change after a call to one of the <type>Param()
methods.public long addressSafe(java.lang.Object value, int offset)
offset
or
NULL
if the specified value
is null. This
address may change after a call to one of the <type>Param()
methods.public java.nio.ByteBuffer buffer()
ByteBuffer
that backs this APIBuffer
.public int booleanParam()
public int byteParam()
public int shortParam()
public int intParam()
public int longParam()
public int floatParam()
public int doubleParam()
public int pointerParam()
public int bufferParam(int size)
public int booleanParam(boolean value)
public int byteParam(byte value)
public int shortParam(short value)
public int intParam(int value)
public int longParam(long value)
public int floatParam(float value)
public int doubleParam(double value)
public int pointerParam(long value)
public int pointerArrayParam(long... pointers)
public int pointerArrayParam(java.nio.ByteBuffer... buffers)
public int pointerArrayParamp(java.nio.ByteBuffer... buffers)
public int pointerArrayParamASCII(java.lang.CharSequence... strings)
The encoded buffers must be later freed with
pointerArrayFree(int, int)
.
public int pointerArrayParamASCIIi(java.lang.CharSequence... strings)
The encoded buffers must be later freed with
pointerArrayFree(int, int)
.
public int pointerArrayParamASCIIp(java.lang.CharSequence... strings)
The encoded buffers must be later freed with
pointerArrayFree(int, int)
.
public int pointerArrayParamUTF8(java.lang.CharSequence... strings)
The encoded buffers must be later freed with
pointerArrayFree(int, int)
.
public int pointerArrayParamUTF8i(java.lang.CharSequence... strings)
The encoded buffers must be later freed with
pointerArrayFree(int, int)
.
public int pointerArrayParamUTF8p(java.lang.CharSequence... strings)
The encoded buffers must be later freed with
pointerArrayFree(int, int)
.
public int pointerArrayParamUTF16(java.lang.CharSequence... strings)
The encoded buffers must be later freed with
pointerArrayFree(int, int)
.
public int pointerArrayParamUTF16i(java.lang.CharSequence... strings)
The encoded buffers must be later freed with
pointerArrayFree(int, int)
.
public int pointerArrayParamUTF16p(java.lang.CharSequence... strings)
The encoded buffers must be later freed with
pointerArrayFree(int, int)
.
public void pointerArrayFree(int offset, int length)
length
memory blocks stored in the APIBuffer, starting at
the specified offset
.public void intParam(int offset, int index, int value)
public void pointerParam(int offset, int index, long value)
public int stringParamASCII(java.lang.CharSequence value, boolean nullTerminated)
public int stringParamUTF8(java.lang.CharSequence value, boolean nullTerminated)
public int stringParamUTF16(java.lang.CharSequence value, boolean nullTerminated)
public boolean booleanValue(int offset)
public byte byteValue(int offset)
public short shortValue(int offset)
public int intValue(int offset)
public long longValue(int offset)
public float floatValue(int offset)
public double doubleValue(int offset)
public long pointerValue(int offset)
public java.lang.String stringValueASCII(int offset, int limit)
public java.lang.String stringValueUTF8(int offset, int limit)
public java.lang.String stringValueUTF16(int offset, int limit)