final class DirectClosureBuffer extends java.lang.Object implements Closure.Buffer
Closure.Buffer
interface to read/write
parameter and return value data in native memoryModifier and Type | Class and Description |
---|---|
private static class |
DirectClosureBuffer.NativeWordIO
Reads annd writes data types that are smaller than the size of a native
long, as a native long for compatibility with FFI.
|
private static class |
DirectClosureBuffer.NativeWordIO32 |
private static class |
DirectClosureBuffer.NativeWordIO64 |
Modifier and Type | Field and Description |
---|---|
private CallContext |
callContext |
private static MemoryIO |
IO |
private static long |
PARAM_SIZE |
private long |
parameters |
private long |
retval |
private static DirectClosureBuffer.NativeWordIO |
WordIO |
Constructor and Description |
---|
DirectClosureBuffer(CallContext callContext,
long retval,
long parameters) |
Modifier and Type | Method and Description |
---|---|
long |
getAddress(int index)
Gets the value of a native pointer parameter.
|
byte |
getByte(int index)
Gets the value of an 8 bit integer parameter.
|
double |
getDouble(int index)
Gets the value of a 64 bit floating point parameter.
|
float |
getFloat(int index)
Gets the value of a 32 bit floating point parameter.
|
int |
getInt(int index)
Gets the value of a 32 bit integer parameter.
|
long |
getLong(int index)
Gets the value of a 64 bit integer parameter.
|
short |
getShort(int index)
Gets the value of a 16 bit integer parameter.
|
long |
getStruct(int index)
Gets the address of a struct parameter that is passed by value.
|
void |
setAddressReturn(long address)
Sets the closure return value to a native pointer value.
|
void |
setByteReturn(byte value)
Sets the closure return value to an 8 bit integer value.
|
void |
setDoubleReturn(double value)
Sets the closure return value to a 64 bit floating point value.
|
void |
setFloatReturn(float value)
Sets the closure return value to a 32 bit floating point value.
|
void |
setIntReturn(int value)
Sets the closure return value to a 32 bit integer value.
|
void |
setLongReturn(long value)
Sets the closure return value to a 64 bit integer value.
|
void |
setShortReturn(short value)
Sets the closure return value to a 16 bit integer value.
|
void |
setStructReturn(byte[] data,
int offset)
Sets the closure return value to the contents of a struct
|
void |
setStructReturn(long value)
Sets the closure return value to the contents of a struct
|
private static final MemoryIO IO
private static final DirectClosureBuffer.NativeWordIO WordIO
private static final long PARAM_SIZE
private final long retval
private final long parameters
private final CallContext callContext
public DirectClosureBuffer(CallContext callContext, long retval, long parameters)
public final byte getByte(int index)
Closure.Buffer
getByte
in interface Closure.Buffer
index
- The parameter indexpublic final short getShort(int index)
Closure.Buffer
getShort
in interface Closure.Buffer
index
- The parameter indexpublic final int getInt(int index)
Closure.Buffer
getInt
in interface Closure.Buffer
index
- The parameter indexpublic final long getLong(int index)
Closure.Buffer
getLong
in interface Closure.Buffer
index
- The parameter indexpublic final float getFloat(int index)
Closure.Buffer
getFloat
in interface Closure.Buffer
index
- The parameter indexpublic final double getDouble(int index)
Closure.Buffer
getDouble
in interface Closure.Buffer
index
- The parameter indexpublic final long getAddress(int index)
Closure.Buffer
getAddress
in interface Closure.Buffer
index
- The parameter indexpublic final long getStruct(int index)
Closure.Buffer
getStruct
in interface Closure.Buffer
index
- The parameter indexpublic final void setByteReturn(byte value)
Closure.Buffer
setByteReturn
in interface Closure.Buffer
value
- The 8 bit integer value to return from the closure.public final void setShortReturn(short value)
Closure.Buffer
setShortReturn
in interface Closure.Buffer
value
- The 16 bit integer value to return from the closure.public final void setIntReturn(int value)
Closure.Buffer
setIntReturn
in interface Closure.Buffer
value
- The 32 bit integer value to return from the closure.public final void setLongReturn(long value)
Closure.Buffer
setLongReturn
in interface Closure.Buffer
value
- The 64 bit integer value to return from the closure.public final void setFloatReturn(float value)
Closure.Buffer
setFloatReturn
in interface Closure.Buffer
value
- The 32 bit floating point value to return from the closure.public final void setDoubleReturn(double value)
Closure.Buffer
setDoubleReturn
in interface Closure.Buffer
value
- The 64 bit floating point value to return from the closure.public final void setAddressReturn(long address)
Closure.Buffer
setAddressReturn
in interface Closure.Buffer
address
- The native pointer value to return from the closure.public void setStructReturn(long value)
Closure.Buffer
setStructReturn
in interface Closure.Buffer
value
- The address of a native struct to return as a struct value from the closure.public void setStructReturn(byte[] data, int offset)
Closure.Buffer
setStructReturn
in interface Closure.Buffer
data
- Struct data packed into a byte array to return as a struct value from the closure.offset
- the offset within the byte array to start copying data