Class DirectClosureBuffer
java.lang.Object
com.kenai.jffi.DirectClosureBuffer
- All Implemented Interfaces:
Closure.Buffer
Implementation of the
Closure.Buffer interface to read/write
parameter and return value data in native memory-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classReads annd writes data types that are smaller than the size of a native long, as a native long for compatibility with FFI.private static final classprivate static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CallContextprivate static final MemoryIOprivate static final longprivate final longprivate final longprivate static final DirectClosureBuffer.NativeWordIO -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal longgetAddress(int index) Gets the value of a native pointer parameter.final bytegetByte(int index) Gets the value of an 8 bit integer parameter.final doublegetDouble(int index) Gets the value of a 64 bit floating point parameter.final floatgetFloat(int index) Gets the value of a 32 bit floating point parameter.final intgetInt(int index) Gets the value of a 32 bit integer parameter.final longgetLong(int index) Gets the value of a 64 bit integer parameter.final shortgetShort(int index) Gets the value of a 16 bit integer parameter.final longgetStruct(int index) Gets the address of a struct parameter that is passed by value.final voidsetAddressReturn(long address) Sets the closure return value to a native pointer value.final voidsetByteReturn(byte value) Sets the closure return value to an 8 bit integer value.final voidsetDoubleReturn(double value) Sets the closure return value to a 64 bit floating point value.final voidsetFloatReturn(float value) Sets the closure return value to a 32 bit floating point value.final voidsetIntReturn(int value) Sets the closure return value to a 32 bit integer value.final voidsetLongReturn(long value) Sets the closure return value to a 64 bit integer value.final voidsetShortReturn(short value) Sets the closure return value to a 16 bit integer value.voidsetStructReturn(byte[] data, int offset) Sets the closure return value to the contents of a structvoidsetStructReturn(long value) Sets the closure return value to the contents of a struct
-
Field Details
-
IO
-
WordIO
-
PARAM_SIZE
private static final long PARAM_SIZE -
retval
private final long retval -
parameters
private final long parameters -
callContext
-
-
Constructor Details
-
DirectClosureBuffer
-
-
Method Details
-
getByte
public final byte getByte(int index) Description copied from interface:Closure.BufferGets the value of an 8 bit integer parameter.- Specified by:
getBytein interfaceClosure.Buffer- Parameters:
index- The parameter index- Returns:
- An 8 bit integer value.
-
getShort
public final short getShort(int index) Description copied from interface:Closure.BufferGets the value of a 16 bit integer parameter.- Specified by:
getShortin interfaceClosure.Buffer- Parameters:
index- The parameter index- Returns:
- A 16 bit integer value.
-
getInt
public final int getInt(int index) Description copied from interface:Closure.BufferGets the value of a 32 bit integer parameter.- Specified by:
getIntin interfaceClosure.Buffer- Parameters:
index- The parameter index- Returns:
- A 32 bit integer value.
-
getLong
public final long getLong(int index) Description copied from interface:Closure.BufferGets the value of a 64 bit integer parameter.- Specified by:
getLongin interfaceClosure.Buffer- Parameters:
index- The parameter index- Returns:
- A 64 bit integer value.
-
getFloat
public final float getFloat(int index) Description copied from interface:Closure.BufferGets the value of a 32 bit floating point parameter.- Specified by:
getFloatin interfaceClosure.Buffer- Parameters:
index- The parameter index- Returns:
- A 32 bit floating point value.
-
getDouble
public final double getDouble(int index) Description copied from interface:Closure.BufferGets the value of a 64 bit floating point parameter.- Specified by:
getDoublein interfaceClosure.Buffer- Parameters:
index- The parameter index- Returns:
- A 64 bit floating point value.
-
getAddress
public final long getAddress(int index) Description copied from interface:Closure.BufferGets the value of a native pointer parameter.- Specified by:
getAddressin interfaceClosure.Buffer- Parameters:
index- The parameter index- Returns:
- A native memory address.
-
getStruct
public final long getStruct(int index) Description copied from interface:Closure.BufferGets the address of a struct parameter that is passed by value.- Specified by:
getStructin interfaceClosure.Buffer- Parameters:
index- The parameter index- Returns:
- A native memory address.
-
setByteReturn
public final void setByteReturn(byte value) Description copied from interface:Closure.BufferSets the closure return value to an 8 bit integer value.- Specified by:
setByteReturnin interfaceClosure.Buffer- Parameters:
value- The 8 bit integer value to return from the closure.
-
setShortReturn
public final void setShortReturn(short value) Description copied from interface:Closure.BufferSets the closure return value to a 16 bit integer value.- Specified by:
setShortReturnin interfaceClosure.Buffer- Parameters:
value- The 16 bit integer value to return from the closure.
-
setIntReturn
public final void setIntReturn(int value) Description copied from interface:Closure.BufferSets the closure return value to a 32 bit integer value.- Specified by:
setIntReturnin interfaceClosure.Buffer- Parameters:
value- The 32 bit integer value to return from the closure.
-
setLongReturn
public final void setLongReturn(long value) Description copied from interface:Closure.BufferSets the closure return value to a 64 bit integer value.- Specified by:
setLongReturnin interfaceClosure.Buffer- Parameters:
value- The 64 bit integer value to return from the closure.
-
setFloatReturn
public final void setFloatReturn(float value) Description copied from interface:Closure.BufferSets the closure return value to a 32 bit floating point value.- Specified by:
setFloatReturnin interfaceClosure.Buffer- Parameters:
value- The 32 bit floating point value to return from the closure.
-
setDoubleReturn
public final void setDoubleReturn(double value) Description copied from interface:Closure.BufferSets the closure return value to a 64 bit floating point value.- Specified by:
setDoubleReturnin interfaceClosure.Buffer- Parameters:
value- The 64 bit floating point value to return from the closure.
-
setAddressReturn
public final void setAddressReturn(long address) Description copied from interface:Closure.BufferSets the closure return value to a native pointer value.- Specified by:
setAddressReturnin interfaceClosure.Buffer- Parameters:
address- The native pointer value to return from the closure.
-
setStructReturn
public void setStructReturn(long value) Description copied from interface:Closure.BufferSets the closure return value to the contents of a struct- Specified by:
setStructReturnin interfaceClosure.Buffer- Parameters:
value- The address of a native struct to return as a struct value from the closure.
-
setStructReturn
public void setStructReturn(byte[] data, int offset) Description copied from interface:Closure.BufferSets the closure return value to the contents of a struct- Specified by:
setStructReturnin interfaceClosure.Buffer- Parameters:
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
-