Package com.kenai.jffi
Class DirectClosureBuffer
- java.lang.Object
-
- com.kenai.jffi.DirectClosureBuffer
-
- All Implemented Interfaces:
Closure.Buffer
final class DirectClosureBuffer extends java.lang.Object implements Closure.Buffer
Implementation of theClosure.Bufferinterface to read/write parameter and return value data in native memory
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classDirectClosureBuffer.NativeWordIOReads annd writes data types that are smaller than the size of a native long, as a native long for compatibility with FFI.private static classDirectClosureBuffer.NativeWordIO32private static classDirectClosureBuffer.NativeWordIO64
-
Field Summary
Fields Modifier and Type Field Description private CallContextcallContextprivate static MemoryIOIOprivate static longPARAM_SIZEprivate longparametersprivate longretvalprivate static DirectClosureBuffer.NativeWordIOWordIO
-
Constructor Summary
Constructors Constructor Description DirectClosureBuffer(CallContext callContext, long retval, long parameters)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetAddress(int index)Gets the value of a native pointer parameter.bytegetByte(int index)Gets the value of an 8 bit integer parameter.doublegetDouble(int index)Gets the value of a 64 bit floating point parameter.floatgetFloat(int index)Gets the value of a 32 bit floating point parameter.intgetInt(int index)Gets the value of a 32 bit integer parameter.longgetLong(int index)Gets the value of a 64 bit integer parameter.shortgetShort(int index)Gets the value of a 16 bit integer parameter.longgetStruct(int index)Gets the address of a struct parameter that is passed by value.voidsetAddressReturn(long address)Sets the closure return value to a native pointer value.voidsetByteReturn(byte value)Sets the closure return value to an 8 bit integer value.voidsetDoubleReturn(double value)Sets the closure return value to a 64 bit floating point value.voidsetFloatReturn(float value)Sets the closure return value to a 32 bit floating point value.voidsetIntReturn(int value)Sets the closure return value to a 32 bit integer value.voidsetLongReturn(long value)Sets the closure return value to a 64 bit integer value.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 Detail
-
IO
private static final MemoryIO IO
-
WordIO
private static final DirectClosureBuffer.NativeWordIO WordIO
-
PARAM_SIZE
private static final long PARAM_SIZE
-
retval
private final long retval
-
parameters
private final long parameters
-
callContext
private final CallContext callContext
-
-
Constructor Detail
-
DirectClosureBuffer
public DirectClosureBuffer(CallContext callContext, long retval, long parameters)
-
-
Method Detail
-
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
-
-