final class Foreign
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
Foreign.InstanceHolder |
private static class |
Foreign.InValidInstanceHolder |
private static class |
Foreign.ValidInstanceHolder |
Modifier and Type | Field and Description |
---|---|
static int |
F_DEFAULT
Default calling convention
|
static int |
F_NOERRNO
Do not save errno after each call
|
static int |
F_PROTECT
Try to capture segmentation faults and convert to java exceptions
|
static int |
F_STDCALL
Windows STDCALL calling convention
|
static int |
JNI_EDETACHED |
static int |
JNI_EEXIST |
static int |
JNI_EINVAL |
static int |
JNI_ENOMEM |
static int |
JNI_ERR |
static int |
JNI_EVERSION |
static int |
JNI_OK |
static int |
MAP_ALIGN |
static int |
MAP_ANON |
static int |
MAP_FIXED
Use the specified address
|
static int |
MAP_NORESERVE |
static int |
MAP_PRIVATE |
static int |
MAP_SHARED
Share changes
|
static int |
MAP_TEXT
Code segment memory
|
static int |
MEM_4MB_PAGES |
static int |
MEM_COMMIT |
static int |
MEM_DECOMMIT |
static int |
MEM_FREE |
static int |
MEM_MAPPED |
static int |
MEM_PHYSICAL |
static int |
MEM_PRIVATE |
static int |
MEM_RELEASE |
static int |
MEM_RESERVE |
static int |
MEM_RESET |
static int |
MEM_TOP_DOWN |
static int |
PAGE_EXECUTE |
static int |
PAGE_EXECUTE_READ |
static int |
PAGE_EXECUTE_READWRITE |
static int |
PAGE_EXECUTE_WRITECOPY |
static int |
PAGE_NOACCESS
Win32 VirtualAlloc/VirtualProtect flags
|
static int |
PAGE_READONLY |
static int |
PAGE_READWRITE |
static int |
PAGE_WRITECOPY |
static int |
PROT_EXEC
Pages can be executed
|
static int |
PROT_NONE
Pages cannot be accessed
|
static int |
PROT_READ
Pages can be read
|
static int |
PROT_WRITE
Pages can be written
|
static int |
RTLD_GLOBAL
All symbols in the library are made available to other libraries
|
static int |
RTLD_LAZY
Perform lazy binding.
|
static int |
RTLD_LOCAL
Symbols in this library are not made available to other libraries
|
static int |
RTLD_NOW
Resolve all symbols when loading the library
|
static int |
TYPE_DOUBLE |
static int |
TYPE_FLOAT |
static int |
TYPE_LONGDOUBLE |
static int |
TYPE_POINTER |
static int |
TYPE_SCHAR |
static int |
TYPE_SINT |
static int |
TYPE_SINT16 |
static int |
TYPE_SINT32 |
static int |
TYPE_SINT64 |
static int |
TYPE_SINT8 |
static int |
TYPE_SLONG |
static int |
TYPE_SSHORT |
static int |
TYPE_STRUCT |
static int |
TYPE_UCHAR |
static int |
TYPE_UINT |
static int |
TYPE_UINT16 |
static int |
TYPE_UINT32 |
static int |
TYPE_UINT64 |
static int |
TYPE_UINT8 |
static int |
TYPE_ULONG |
static int |
TYPE_USHORT |
static int |
TYPE_VOID |
static int |
VERSION_MAJOR |
static int |
VERSION_MICRO |
static int |
VERSION_MINOR |
Modifier | Constructor and Description |
---|---|
private |
Foreign() |
Modifier and Type | Method and Description |
---|---|
(package private) static long |
allocateMemory(long size,
boolean clear)
Allocates native memory.
|
(package private) java.lang.Object |
allocObject(java.lang.Class clazz) |
(package private) long |
closureMagazineGet(long closurePool,
java.lang.Object proxy) |
(package private) long |
compileNativeMethods(long[] methods) |
(package private) static void |
copyMemory(long src,
long dst,
long size)
Copies contents of a native memory location to another native memory location.
|
(package private) static void |
copyMemoryChecked(long src,
long dst,
long size)
Copies contents of a native memory location to another native memory location.
|
(package private) java.lang.Class |
defineClass(java.lang.String name,
java.lang.Object loader,
byte[] buf,
int off,
int len) |
(package private) java.lang.Class |
defineClass(java.lang.String name,
java.lang.Object loader,
java.nio.ByteBuffer buf) |
(package private) static void |
dlclose(long handle)
Closes a dynamic library opened by
dlopen(java.lang.String, int) . |
(package private) static java.lang.String |
dlerror()
Gets the last error raised by
dlopen(java.lang.String, int) or dlsym(long, java.lang.String) |
(package private) static long |
dlopen(java.lang.String name,
int flags)
Opens a dynamic library.
|
(package private) static long |
dlsym(long handle,
java.lang.String name)
Locates the memory address of a dynamic library symbol.
|
(package private) void |
fatalError(java.lang.String msg) |
(package private) void |
freeAggregate(long handle)
Frees a FFI struct, union or array handle allocated via
newStruct(long[], boolean) or newArray(long, int) . |
(package private) void |
freeCallContext(long callContext)
Frees a call context created by
newCallContext(long, long[], int) |
(package private) void |
freeClosureMagazine(long closurePool) |
(package private) void |
freeCompiledMethods(long handle) |
(package private) static void |
freeMemory(long address)
Releases memory allocated via
allocateMemory(long, boolean) back to the system. |
(package private) void |
freeNativeMethod(long handle) |
(package private) static long |
getAddress(long address)
Reads a native memory address from a native memory location.
|
(package private) static long |
getAddressChecked(long address)
Reads a native memory address from a native memory location.
|
(package private) java.lang.String |
getArch() |
(package private) static byte |
getByte(long address)
Reads an 8 bit integer from a native memory location.
|
(package private) static void |
getByteArray(long address,
byte[] data,
int offset,
int length)
Reads a java byte array from native memory.
|
(package private) static void |
getByteArrayChecked(long address,
byte[] data,
int offset,
int length)
Reads a java byte array from native memory.
|
(package private) static byte |
getByteChecked(long address)
Reads an 8 bit integer from a native memory location.
|
(package private) int |
getCallContextRawParameterSize(long callContext)
Gets the size required to pack parameters for the function in libffi raw format.
|
(package private) static void |
getCharArray(long address,
char[] data,
int offset,
int length)
Reads a java char array from native memory.
|
(package private) static void |
getCharArrayChecked(long address,
char[] data,
int offset,
int length)
Reads a java char array from native memory.
|
(package private) long |
getDirectBufferAddress(java.nio.Buffer buffer)
Gets the native memory address of a direct ByteBuffer
|
(package private) static double |
getDouble(long address)
Reads a 64 bit floating point value from a native memory location.
|
(package private) static void |
getDoubleArray(long address,
double[] data,
int offset,
int length)
Reads a java double array from native memory.
|
(package private) static void |
getDoubleArrayChecked(long address,
double[] data,
int offset,
int length)
Reads a java double array from native memory.
|
(package private) static double |
getDoubleChecked(long address)
Reads a 64 bit floating point value from a native memory location.
|
(package private) static float |
getFloat(long address)
Reads a 32 bit floating point value from a native memory location.
|
(package private) static void |
getFloatArray(long address,
float[] data,
int offset,
int length)
Reads a java float array from native memory.
|
(package private) static void |
getFloatArrayChecked(long address,
float[] data,
int offset,
int length)
Reads a java float array from native memory.
|
(package private) static float |
getFloatChecked(long address)
Reads a 32 bit floating point value from a native memory location.
|
static Foreign |
getInstance() |
(package private) static int |
getInt(long address)
Reads a 32 bit integer from a native memory location.
|
(package private) static void |
getIntArray(long address,
int[] data,
int offset,
int length)
Reads a java int array from native memory.
|
(package private) static void |
getIntArrayChecked(long address,
int[] data,
int offset,
int length)
Reads a java int array from native memory.
|
(package private) static int |
getIntChecked(long address)
Reads a 32 bit integer from a native memory location.
|
(package private) long |
getJavaVM() |
(package private) int |
getJNIVersion() |
(package private) static int |
getLastError()
Gets the last error returned by a native function
|
(package private) static long |
getLong(long address)
Reads a 64 bit integer from a native memory location.
|
(package private) static void |
getLongArray(long address,
long[] data,
int offset,
int length)
Reads a java long array from native memory.
|
(package private) static void |
getLongArrayChecked(long address,
long[] data,
int offset,
int length)
Reads a java long array from native memory.
|
(package private) static long |
getLongChecked(long address)
Reads a 64 bit integer from a native memory location.
|
(package private) long |
getSaveErrnoCtxFunction() |
(package private) long |
getSaveErrnoFunction() |
(package private) static short |
getShort(long address)
Reads a 16 bit integer from a native memory location.
|
(package private) static void |
getShortArray(long address,
short[] data,
int offset,
int length)
Reads a java short array from native memory.
|
(package private) static void |
getShortArrayChecked(long address,
short[] data,
int offset,
int length)
Reads a java short array from native memory.
|
(package private) static short |
getShortChecked(long address)
Reads a 16 bit integer from a native memory location.
|
(package private) int |
getTypeAlign(long handle)
Gets the minimum required alignment of the FFI type
|
(package private) int |
getTypeSize(long handle)
Gets the native size of the type
|
(package private) int |
getTypeType(long handle)
Gets the primitive type enum for the FFI type
|
(package private) int |
getVersion()
Gets the native stub library version.
|
private static int |
getVersionField(java.lang.String name) |
(package private) static byte[] |
getZeroTerminatedByteArray(long address)
Copies a zero (nul) terminated by array from native memory.
|
(package private) static byte[] |
getZeroTerminatedByteArray(long address,
int maxlen)
Copies a zero (nul) terminated by array from native memory.
|
(package private) static byte[] |
getZeroTerminatedByteArrayChecked(long address)
Copies a zero Checked(nul) terminated by array from native memory.
|
(package private) static byte[] |
getZeroTerminatedByteArrayChecked(long address,
int maxlen)
Copies a zero Checked(nul) terminated by array from native memory.
|
private void |
init()
Initializes any native method/field/class ids
|
(package private) static int |
invokeArrayO1Int32(long callContext,
long function,
byte[] buffer,
java.lang.Object o1,
int o1Info,
int o1off,
int o1len) |
(package private) static long |
invokeArrayO1Int64(long callContext,
long function,
byte[] buffer,
java.lang.Object o1,
int o1Info,
int o1off,
int o1len) |
(package private) static int |
invokeArrayO2Int32(long callContext,
long function,
byte[] buffer,
java.lang.Object o1,
int o1Info,
int o1off,
int o1len,
java.lang.Object o2,
int o2info,
int o2off,
int o2len) |
(package private) static long |
invokeArrayO2Int64(long callContext,
long function,
byte[] buffer,
java.lang.Object o1,
int o1Info,
int o1off,
int o1len,
java.lang.Object o2,
int o2info,
int o2off,
int o2len) |
(package private) static double |
invokeArrayReturnDouble(long callContext,
long function,
byte[] buffer)
Invokes a function that returns a 64 bit floating point value.
|
(package private) static float |
invokeArrayReturnFloat(long callContext,
long function,
byte[] buffer)
Invokes a function that returns a 32 bit floating point value.
|
(package private) static int |
invokeArrayReturnInt(long callContext,
long function,
byte[] buffer)
Invokes a function that returns a 32 bit integer.
|
(package private) static long |
invokeArrayReturnLong(long callContext,
long function,
byte[] buffer)
Invokes a function that returns a 64 bit integer.
|
(package private) static void |
invokeArrayReturnStruct(long callContext,
long function,
byte[] paramBuffer,
byte[] returnBuffer,
int offset)
Invokes a function and pack the return value into a byte array.
|
(package private) static double |
invokeArrayWithObjectsDouble(long callContext,
long function,
byte[] buffer,
int objectCount,
int[] objectInfo,
java.lang.Object[] objects) |
(package private) static float |
invokeArrayWithObjectsFloat(long callContext,
long function,
byte[] buffer,
int objectCount,
int[] objectInfo,
java.lang.Object[] objects) |
(package private) static int |
invokeArrayWithObjectsInt32(long callContext,
long function,
byte[] buffer,
int objectCount,
int[] objectInfo,
java.lang.Object[] objects) |
(package private) static long |
invokeArrayWithObjectsInt64(long callContext,
long function,
byte[] buffer,
int objectCount,
int[] objectInfo,
java.lang.Object[] objects) |
(package private) static java.lang.Object |
invokeArrayWithObjectsReturnObject(long callContext,
long function,
byte[] paramBuffer,
int objectCount,
int[] objectInfo,
java.lang.Object[] objects)
Invokes a function that returns a java object.
|
(package private) static void |
invokeArrayWithObjectsReturnStruct(long callContext,
long function,
byte[] buffer,
int objectCount,
int[] objectInfo,
java.lang.Object[] objects,
byte[] returnBuffer,
int returnBufferOffset) |
(package private) static int |
invokeI0(long callContext,
long function)
Invokes a function with no arguments, and returns a 32 bit integer.
|
(package private) static int |
invokeI0NoErrno(long callContext,
long function)
Invokes a function with no arguments, and returns a 32 bit integer.
|
(package private) static int |
invokeI1(long callContext,
long function,
int arg1)
Invokes a function with one integer argument, and returns a 32 bit integer.
|
(package private) static int |
invokeI1NoErrno(long callContext,
long function,
int arg1)
Invokes a function with one integer argument, and returns a 32 bit integer.
|
(package private) static int |
invokeI2(long callContext,
long function,
int arg1,
int arg2)
Invokes a function with two integer arguments, and returns a 32 bit integer.
|
(package private) static int |
invokeI2NoErrno(long callContext,
long function,
int arg1,
int arg2)
Invokes a function with two integer arguments, and returns a 32 bit integer.
|
(package private) static int |
invokeI3(long callContext,
long function,
int arg1,
int arg2,
int arg3)
Invokes a function with three integer arguments, and returns a 32 bit integer.
|
(package private) static int |
invokeI3NoErrno(long callContext,
long function,
int arg1,
int arg2,
int arg3)
Invokes a function with three integer arguments, and returns a 32 bit integer.
|
(package private) static int |
invokeI4(long callContext,
long function,
int arg1,
int arg2,
int arg3,
int arg4)
Invokes a function with four integer arguments, and returns a 32 bit integer.
|
(package private) static int |
invokeI4NoErrno(long callContext,
long function,
int arg1,
int arg2,
int arg3,
int arg4) |
(package private) static int |
invokeI5(long callContext,
long function,
int arg1,
int arg2,
int arg3,
int arg4,
int arg5)
Invokes a function with five integer arguments, and returns a 32 bit integer.
|
(package private) static int |
invokeI5NoErrno(long callContext,
long function,
int arg1,
int arg2,
int arg3,
int arg4,
int arg5) |
(package private) static int |
invokeI6(long callContext,
long function,
int arg1,
int arg2,
int arg3,
int arg4,
int arg5,
int arg6)
Invokes a function with six integer arguments, and returns a 32 bit integer.
|
(package private) static int |
invokeI6NoErrno(long callContext,
long function,
int arg1,
int arg2,
int arg3,
int arg4,
int arg5,
int arg6) |
(package private) static long |
invokeL0(long ctx,
long function)
Invokes a function with no arguments, and returns a 64 bit integer.
|
(package private) static long |
invokeL0NoErrno(long ctx,
long function) |
(package private) static long |
invokeL1(long ctx,
long function,
long arg1)
Invokes a function with one 64 bit integer argument, and returns a 64 bit integer.
|
(package private) static long |
invokeL1NoErrno(long ctx,
long function,
long arg1) |
(package private) static long |
invokeL2(long ctx,
long function,
long arg1,
long arg2)
Invokes a function with two 64 bit integer arguments, and returns a 64 bit integer.
|
(package private) static long |
invokeL2NoErrno(long ctx,
long function,
long arg1,
long arg2) |
(package private) static long |
invokeL3(long ctx,
long function,
long arg1,
long arg2,
long arg3)
Invokes a function with three 64 bit integer arguments, and returns a 64 bit integer.
|
(package private) static long |
invokeL3NoErrno(long ctx,
long function,
long arg1,
long arg2,
long arg3) |
(package private) static long |
invokeL4(long ctx,
long function,
long arg1,
long arg2,
long arg3,
long arg4)
Invokes a function with four 64 bit integer arguments, and returns a 64 bit integer.
|
(package private) static long |
invokeL4NoErrno(long ctx,
long function,
long arg1,
long arg2,
long arg3,
long arg4) |
(package private) static long |
invokeL5(long ctx,
long function,
long arg1,
long arg2,
long arg3,
long arg4,
long arg5)
Invokes a function with five 64 bit integer arguments, and returns a 64 bit integer.
|
(package private) static long |
invokeL5NoErrno(long ctx,
long function,
long arg1,
long arg2,
long arg3,
long arg4,
long arg5) |
(package private) static long |
invokeL6(long ctx,
long function,
long arg1,
long arg2,
long arg3,
long arg4,
long arg5,
long arg6)
Invokes a function with six 64 bit integer arguments, and returns a 64 bit integer.
|
(package private) static long |
invokeL6NoErrno(long ctx,
long function,
long arg1,
long arg2,
long arg3,
long arg4,
long arg5,
long arg6) |
(package private) static long |
invokeN0(long ctx,
long function)
Invokes a function with zero numeric arguments, and returns a numeric value.
|
(package private) static long |
invokeN1(long ctx,
long function,
long arg1)
Invokes a function with one numeric arguments, and returns a numeric value.
|
(package private) static long |
invokeN1O1(long callContext,
long functionAddress,
long n1,
java.lang.Object o1,
int o1flags,
int o1off,
int o1len)
Invokes a function with one numeric argument, and returns a numeric value.
|
(package private) static long |
invokeN2(long ctx,
long function,
long arg1,
long arg2)
Invokes a function with two numeric arguments, and returns a numeric value.
|
(package private) static long |
invokeN2O1(long callContext,
long functionAddress,
long n1,
long n2,
java.lang.Object o1,
int o1flags,
int o1off,
int o1len)
Invokes a function with two numeric arguments, and returns a numeric value.
|
(package private) static long |
invokeN2O2(long callContext,
long functionAddress,
long n1,
long n2,
java.lang.Object o1,
int o1flags,
int o1off,
int o1len,
java.lang.Object o2,
int o2flags,
int o2off,
int o2len)
Invokes a function with two numeric arguments, and returns a numeric value.
|
(package private) static long |
invokeN3(long ctx,
long function,
long arg1,
long arg2,
long arg3)
Invokes a function with three numeric arguments, and returns a numeric value.
|
(package private) static long |
invokeN3O1(long callContext,
long functionAddress,
long n1,
long n2,
long n3,
java.lang.Object o1,
int o1flags,
int o1off,
int o1len)
Invokes a function with three numeric arguments, and returns a numeric value.
|
(package private) static long |
invokeN3O2(long callContext,
long functionAddress,
long n1,
long n2,
long n3,
java.lang.Object o1,
int o1flags,
int o1off,
int o1len,
java.lang.Object o2,
int o2flags,
int o2off,
int o2len) |
(package private) static long |
invokeN3O3(long callContext,
long functionAddress,
long n1,
long n2,
long n3,
java.lang.Object o1,
int o1flags,
int o1off,
int o1len,
java.lang.Object o2,
int o2flags,
int o2off,
int o2len,
java.lang.Object o3,
int o3flags,
int o3off,
int o3len) |
(package private) static long |
invokeN4(long ctx,
long function,
long arg1,
long arg2,
long arg3,
long arg4)
Invokes a function with four numeric arguments, and returns a numeric value.
|
(package private) static long |
invokeN4O1(long callContext,
long functionAddress,
long n1,
long n2,
long n3,
long n4,
java.lang.Object o1,
int o1flags,
int o1off,
int o1len) |
(package private) static long |
invokeN4O2(long callContext,
long functionAddress,
long n1,
long n2,
long n3,
long n4,
java.lang.Object o1,
int o1flags,
int o1off,
int o1len,
java.lang.Object o2,
int o2flags,
int o2off,
int o2len) |
(package private) static long |
invokeN4O3(long callContext,
long functionAddress,
long n1,
long n2,
long n3,
long n4,
java.lang.Object o1,
int o1flags,
int o1off,
int o1len,
java.lang.Object o2,
int o2flags,
int o2off,
int o2len,
java.lang.Object o3,
int o3flags,
int o3off,
int o3len) |
(package private) static long |
invokeN4O4(long callContext,
long functionAddress,
long n1,
long n2,
long n3,
long n4,
java.lang.Object o1,
int o1flags,
int o1off,
int o1len,
java.lang.Object o2,
int o2flags,
int o2off,
int o2len,
java.lang.Object o3,
int o3flags,
int o3off,
int o3len,
java.lang.Object o4,
int o4flags,
int o4off,
int o4len) |
(package private) static long |
invokeN5(long ctx,
long function,
long arg1,
long arg2,
long arg3,
long arg4,
long arg5)
Invokes a function with five numeric arguments, and returns a numeric value.
|
(package private) static long |
invokeN5O1(long callContext,
long functionAddress,
long n1,
long n2,
long n3,
long n4,
long n5,
java.lang.Object o1,
int o1flags,
int o1off,
int o1len) |
(package private) static long |
invokeN5O2(long callContext,
long functionAddress,
long n1,
long n2,
long n3,
long n4,
long n5,
java.lang.Object o1,
int o1flags,
int o1off,
int o1len,
java.lang.Object o2,
int o2flags,
int o2off,
int o2len) |
(package private) static long |
invokeN5O3(long callContext,
long functionAddress,
long n1,
long n2,
long n3,
long n4,
long n5,
java.lang.Object o1,
int o1flags,
int o1off,
int o1len,
java.lang.Object o2,
int o2flags,
int o2off,
int o2len,
java.lang.Object o3,
int o3flags,
int o3off,
int o3len) |
(package private) static long |
invokeN5O4(long callContext,
long functionAddress,
long n1,
long n2,
long n3,
long n4,
long n5,
java.lang.Object o1,
int o1flags,
int o1off,
int o1len,
java.lang.Object o2,
int o2flags,
int o2off,
int o2len,
java.lang.Object o3,
int o3flags,
int o3off,
int o3len,
java.lang.Object o4,
int o4flags,
int o4off,
int o4len) |
(package private) static long |
invokeN5O5(long callContext,
long functionAddress,
long n1,
long n2,
long n3,
long n4,
long n5,
java.lang.Object o1,
int o1flags,
int o1off,
int o1len,
java.lang.Object o2,
int o2flags,
int o2off,
int o2len,
java.lang.Object o3,
int o3flags,
int o3off,
int o3len,
java.lang.Object o4,
int o4flags,
int o4off,
int o4len,
java.lang.Object o5,
int o5flags,
int o5off,
int o5len) |
(package private) static long |
invokeN6(long ctx,
long function,
long arg1,
long arg2,
long arg3,
long arg4,
long arg5,
long arg6)
Invokes a function with six numeric arguments, and returns a numeric value.
|
(package private) static long |
invokeN6O1(long callContext,
long functionAddress,
long n1,
long n2,
long n3,
long n4,
long n5,
long n6,
java.lang.Object o1,
int o1flags,
int o1off,
int o1len) |
(package private) static long |
invokeN6O2(long callContext,
long functionAddress,
long n1,
long n2,
long n3,
long n4,
long n5,
long n6,
java.lang.Object o1,
int o1flags,
int o1off,
int o1len,
java.lang.Object o2,
int o2flags,
int o2off,
int o2len) |
(package private) static long |
invokeN6O3(long callContext,
long functionAddress,
long n1,
long n2,
long n3,
long n4,
long n5,
long n6,
java.lang.Object o1,
int o1flags,
int o1off,
int o1len,
java.lang.Object o2,
int o2flags,
int o2off,
int o2len,
java.lang.Object o3,
int o3flags,
int o3off,
int o3len) |
(package private) static long |
invokeN6O4(long callContext,
long functionAddress,
long n1,
long n2,
long n3,
long n4,
long n5,
long n6,
java.lang.Object o1,
int o1flags,
int o1off,
int o1len,
java.lang.Object o2,
int o2flags,
int o2off,
int o2len,
java.lang.Object o3,
int o3flags,
int o3off,
int o3len,
java.lang.Object o4,
int o4flags,
int o4off,
int o4len) |
(package private) static long |
invokeN6O5(long callContext,
long functionAddress,
long n1,
long n2,
long n3,
long n4,
long n5,
long n6,
java.lang.Object o1,
int o1flags,
int o1off,
int o1len,
java.lang.Object o2,
int o2flags,
int o2off,
int o2len,
java.lang.Object o3,
int o3flags,
int o3off,
int o3len,
java.lang.Object o4,
int o4flags,
int o4off,
int o4len,
java.lang.Object o5,
int o5flags,
int o5off,
int o5len) |
(package private) static long |
invokeN6O6(long callContext,
long functionAddress,
long n1,
long n2,
long n3,
long n4,
long n5,
long n6,
java.lang.Object o1,
int o1flags,
int o1off,
int o1len,
java.lang.Object o2,
int o2flags,
int o2off,
int o2len,
java.lang.Object o3,
int o3flags,
int o3off,
int o3len,
java.lang.Object o4,
int o4flags,
int o4off,
int o4len,
java.lang.Object o5,
int o5flags,
int o5off,
int o5len,
java.lang.Object o6,
int o6flags,
int o6off,
int o6len) |
(package private) static void |
invokePointerParameterArray(long callContext,
long functionContext,
long returnBuffer,
long[] parameters)
Invokes a function, with the parameters loaded into native memory buffers,
and the function result is stored in a native memory buffer.
|
private static boolean |
isFaultProtectionEnabled() |
(package private) static boolean |
isMemoryProtectionEnabled() |
(package private) boolean |
isRawParameterPackingEnabled() |
(package private) void |
longDoubleFromDouble(double doubleValue,
byte[] buf,
int off,
int len) |
(package private) void |
longDoubleFromString(java.lang.String doubleString,
byte[] buf,
int off,
int len) |
(package private) double |
longDoubleToDouble(byte[] buf,
int off,
int len) |
(package private) java.lang.String |
longDoubleToEngineeringString(byte[] buf,
int off,
int len) |
(package private) java.lang.String |
longDoubleToPlainString(byte[] buf,
int off,
int len) |
(package private) java.lang.String |
longDoubleToString(byte[] buf,
int off,
int len) |
(package private) long |
lookupBuiltinType(int type)
Gets the address of the ffi_type structure for the builtin type
|
(package private) static long |
memchr(long address,
int value,
long len)
Gets the address of a byte value in a native memory region.
|
(package private) static long |
memchrChecked(long address,
int value,
long len)
Gets the address of a byte value in a native memory region.
|
(package private) static void |
memcpy(long dst,
long src,
long len)
Copies non-overlapping memory areas.
|
(package private) static void |
memcpyChecked(long dst,
long src,
long len)
Copies non-overlapping memory areas.
|
(package private) static void |
memmove(long dst,
long src,
long len)
Copies potentially overlapping memory areas.
|
(package private) static void |
memmoveChecked(long dst,
long src,
long len)
Copies potentially overlapping memory areas.
|
(package private) static long |
mmap(long addr,
long len,
int prot,
int flags,
int fd,
long off)
Calls the Unix mmap(2) function
This method is undefined on windows.
|
(package private) static int |
mprotect(long addr,
long len,
int prot)
Calls the Unix mprotect(2) function.
|
(package private) static int |
munmap(long addr,
long len)
Calls the Unix munmap(2) function.
|
(package private) long |
newArray(long elementType,
int length)
Allocates a new FFI array type.
|
(package private) long |
newCallContext(long returnType,
long[] paramTypes,
int flags)
Creates a new native call context.
|
(package private) long |
newClosureMagazine(long contextAddress,
java.lang.reflect.Method closureMethod,
boolean callWithPrimitiveParameters) |
(package private) java.nio.ByteBuffer |
newDirectByteBuffer(long address,
int capacity)
Creates a new Direct ByteBuffer for a native memory region.
|
private static java.lang.UnsatisfiedLinkError |
newLoadError(java.lang.Throwable cause) |
(package private) long |
newNativeMethod(java.lang.String name,
java.lang.String signature,
long functionContext) |
(package private) long |
newStruct(long[] fields,
boolean isUnion)
Allocates a new FFI struct or union layout
|
(package private) static long |
pageSize()
Gets the size of a page of memory.
|
(package private) static void |
putAddress(long address,
long value)
Writes a native memory address value to a native memory location.
|
(package private) static void |
putAddressChecked(long address,
long value)
Writes a native memory address value to a native memory location.
|
(package private) static void |
putByte(long address,
byte value)
Writes an 8 bit integer value to a native memory location.
|
(package private) static void |
putByteArray(long address,
byte[] data,
int offset,
int length)
Writes a java byte array to native memory.
|
(package private) static void |
putByteArrayChecked(long address,
byte[] data,
int offset,
int length)
Writes a java byte array to native memory.
|
(package private) static void |
putByteChecked(long address,
byte value)
Writes an 8 bit integer value to a native memory location.
|
(package private) static void |
putCharArray(long address,
char[] data,
int offset,
int length)
Writes a java char array to native memory.
|
(package private) static void |
putCharArrayChecked(long address,
char[] data,
int offset,
int length)
Writes a java char array to native memory.
|
(package private) static void |
putDouble(long address,
double value)
Writes a 64 bit floating point value to a native memory location.
|
(package private) static void |
putDoubleArray(long address,
double[] data,
int offset,
int length)
Writes a java double array to native memory.
|
(package private) static void |
putDoubleArrayChecked(long address,
double[] data,
int offset,
int length)
Writes a java double array to native memory.
|
(package private) static void |
putDoubleChecked(long address,
double value)
Writes a 64 bit floating point value to a native memory location.
|
(package private) static void |
putFloat(long address,
float value)
Writes a 32 bit floating point value to a native memory location.
|
(package private) static void |
putFloatArray(long address,
float[] data,
int offset,
int length)
Writes a java double array to native memory.
|
(package private) static void |
putFloatArrayChecked(long address,
float[] data,
int offset,
int length)
Writes a java double array to native memory.
|
(package private) static void |
putFloatChecked(long address,
float value)
Writes a 32 bit floating point value to a native memory location.
|
(package private) static void |
putInt(long address,
int value)
Writes a 32 bit integer value to a native memory location.
|
(package private) static void |
putIntArray(long address,
int[] data,
int offset,
int length)
Writes a java int array to native memory.
|
(package private) static void |
putIntArrayChecked(long address,
int[] data,
int offset,
int length)
Writes a java int array to native memory.
|
(package private) static void |
putIntChecked(long address,
int value)
Writes a 32 bit integer value to a native memory location.
|
(package private) static void |
putLong(long address,
long value)
Writes a 64 bit integer value to a native memory location.
|
(package private) static void |
putLongArray(long address,
long[] data,
int offset,
int length)
Writes a java long array to native memory.
|
(package private) static void |
putLongArrayChecked(long address,
long[] data,
int offset,
int length)
Writes a java long array to native memory.
|
(package private) static void |
putLongChecked(long address,
long value)
Writes a 64 bit integer value to a native memory location.
|
(package private) static void |
putShort(long address,
short value)
Writes a 16 bit integer value to a native memory location.
|
(package private) static void |
putShortArray(long address,
short[] data,
int offset,
int length)
Writes a java short array to native memory.
|
(package private) static void |
putShortArrayChecked(long address,
short[] data,
int offset,
int length)
Writes a java short array to native memory.
|
(package private) static void |
putShortChecked(long address,
short value)
Writes a 16 bit integer value to a native memory location.
|
(package private) static void |
putZeroTerminatedByteArray(long address,
byte[] data,
int offset,
int length)
Copies a java byte array to native memory and appends a NUL terminating byte.
|
(package private) static void |
putZeroTerminatedByteArrayChecked(long address,
byte[] data,
int offset,
int length)
Copies a java byte array to native memory and appends a NUL terminating byte.
|
(package private) boolean |
registerNativeMethods(java.lang.Class clazz,
long handle) |
(package private) int |
registerNatives(java.lang.Class clazz,
long methods,
int methodCount) |
(package private) void |
setCallContextErrorFunction(long ctx,
long fn) |
(package private) static void |
setLastError(int error)
Sets the native errno value
|
(package private) static void |
setMemory(long address,
long size,
byte value)
Sets a region of native memory to a specific byte value.
|
(package private) static void |
setMemoryChecked(long address,
long size,
byte value)
Sets a region of native memory to a specific byte value.
|
(package private) static long |
strlen(long address)
Gets the length of a native ascii or utf-8 string.
|
(package private) static long |
strlenChecked(long address)
Gets the length of a native ascii or utf-8 string.
|
(package private) void |
unregisterNativeMethods(java.lang.Class clazz) |
(package private) int |
unregisterNatives(java.lang.Class clazz) |
(package private) static long |
VirtualAlloc(long addr,
int size,
int flags,
int prot) |
(package private) static boolean |
VirtualFree(long addr,
int size,
int flags) |
(package private) static boolean |
VirtualProtect(long addr,
int size,
int prot) |
public static final int VERSION_MAJOR
public static final int VERSION_MINOR
public static final int VERSION_MICRO
public static final int TYPE_VOID
public static final int TYPE_FLOAT
public static final int TYPE_DOUBLE
public static final int TYPE_LONGDOUBLE
public static final int TYPE_UINT8
public static final int TYPE_SINT8
public static final int TYPE_UINT16
public static final int TYPE_SINT16
public static final int TYPE_UINT32
public static final int TYPE_SINT32
public static final int TYPE_UINT64
public static final int TYPE_SINT64
public static final int TYPE_STRUCT
public static final int TYPE_POINTER
public static final int TYPE_UCHAR
public static final int TYPE_SCHAR
public static final int TYPE_USHORT
public static final int TYPE_SSHORT
public static final int TYPE_UINT
public static final int TYPE_SINT
public static final int TYPE_ULONG
public static final int TYPE_SLONG
public static final int RTLD_LAZY
public static final int RTLD_NOW
public static final int RTLD_LOCAL
public static final int RTLD_GLOBAL
public static final int PROT_READ
public static final int PROT_WRITE
public static final int PROT_EXEC
public static final int PROT_NONE
public static final int MAP_SHARED
public static final int MAP_PRIVATE
public static final int MAP_FIXED
public static final int MAP_NORESERVE
public static final int MAP_ANON
public static final int MAP_ALIGN
public static final int MAP_TEXT
public static final int PAGE_NOACCESS
public static final int PAGE_READONLY
public static final int PAGE_READWRITE
public static final int PAGE_WRITECOPY
public static final int PAGE_EXECUTE
public static final int PAGE_EXECUTE_READ
public static final int PAGE_EXECUTE_READWRITE
public static final int PAGE_EXECUTE_WRITECOPY
public static final int MEM_COMMIT
public static final int MEM_RESERVE
public static final int MEM_DECOMMIT
public static final int MEM_RELEASE
public static final int MEM_FREE
public static final int MEM_PRIVATE
public static final int MEM_MAPPED
public static final int MEM_RESET
public static final int MEM_TOP_DOWN
public static final int MEM_PHYSICAL
public static final int MEM_4MB_PAGES
public static final int JNI_OK
public static final int JNI_ERR
public static final int JNI_EDETACHED
public static final int JNI_EVERSION
public static final int JNI_ENOMEM
public static final int JNI_EEXIST
public static final int JNI_EINVAL
public static final int F_DEFAULT
public static final int F_STDCALL
public static final int F_NOERRNO
public static final int F_PROTECT
private static java.lang.UnsatisfiedLinkError newLoadError(java.lang.Throwable cause)
public static Foreign getInstance()
private static int getVersionField(java.lang.String name)
final int getVersion()
private void init()
private static boolean isFaultProtectionEnabled()
static boolean isMemoryProtectionEnabled()
static long dlopen(java.lang.String name, int flags)
name
- The name of the dynamic library to open. Pass null to get a
handle to the current process.flags
- The flags to dlopen. A bit mask of RTLD_LAZY
, RTLD_NOW
,
RTLD_LOCAL
, RTLD_GLOBAL
static void dlclose(long handle)
dlopen(java.lang.String, int)
.handle
- The dynamic library handle returned by dlopen(java.lang.String, int)
static long dlsym(long handle, java.lang.String name)
handle
- A dynamic library handle obtained from dlopen(java.lang.String, int)
name
- The name of the symbol.static java.lang.String dlerror()
dlopen(java.lang.String, int)
or dlsym(long, java.lang.String)
static long allocateMemory(long size, boolean clear)
size
- The number of bytes of memory to allocateclear
- Whether the memory should be cleared (each byte set to zero).static void freeMemory(long address)
allocateMemory(long, boolean)
back to the system.address
- The address of the memory to release.static long pageSize()
static long mmap(long addr, long len, int prot, int flags, int fd, long off)
addr
- The desired address to map the memory at, or 0 for random address.len
- The length of the memory region.prot
- The protection mode for the memory region.flags
- fd
- off
- static int munmap(long addr, long len)
addr
- The address to unmap.len
- The size of the region.static int mprotect(long addr, long len, int prot)
addr
- The address to unmap.len
- The size of the region.prot
- The new protection mode.static long VirtualAlloc(long addr, int size, int flags, int prot)
static boolean VirtualFree(long addr, int size, int flags)
static boolean VirtualProtect(long addr, int size, int prot)
final long newCallContext(long returnType, long[] paramTypes, int flags)
returnType
- The return type of the functionparamTypes
- The types of the parametersflags
- A bitmask of F_DEFAULT, F_STDCALL, F_NOERRNO, F_PROTECTfinal void freeCallContext(long callContext)
newCallContext(long, long[], int)
callContext
- The native call context to freefinal int getCallContextRawParameterSize(long callContext)
callContext
- The call contextfinal boolean isRawParameterPackingEnabled()
static int getLastError()
static void setLastError(int error)
error
- The value to set errno to.final long newClosureMagazine(long contextAddress, java.lang.reflect.Method closureMethod, boolean callWithPrimitiveParameters)
final void freeClosureMagazine(long closurePool)
final long closureMagazineGet(long closurePool, java.lang.Object proxy)
final long lookupBuiltinType(int type)
type
- The FFI type enum valuefinal int getTypeSize(long handle)
handle
- Address of the type structurefinal int getTypeAlign(long handle)
handle
- Address of the type structurefinal int getTypeType(long handle)
handle
- Address of the type structurefinal long newStruct(long[] fields, boolean isUnion)
fields
- An array of ffi_type pointers describing the fields of the structisUnion
- If true, then fields are all positioned at offset=0, else
fields are sequentially positioned.freeAggregate(long)
final long newArray(long elementType, int length)
elementType
- the type of each element in the array.length
- the number of elements in the array.freeAggregate(long)
final void freeAggregate(long handle)
newStruct(long[], boolean)
or newArray(long, int)
.handle
- The FFI struct handlestatic int invokeI0(long callContext, long function)
callContext
- The address of the call context structure from newCallContext(long, long[], int)
.function
- The address of the function to invoke.static int invokeI0NoErrno(long callContext, long function)
callContext
- The address of the call context structure from newCallContext(long, long[], int)
.function
- The address of the function to invoke.static int invokeI1(long callContext, long function, int arg1)
callContext
- The address of the call context structure from newCallContext(long, long[], int)
.function
- The address of the function to invoke.arg1
- The 32 bit integer argument.static int invokeI1NoErrno(long callContext, long function, int arg1)
callContext
- The address of the call context structure from newCallContext(long, long[], int)
.function
- The address of the function to invoke.arg1
- The 32 bit integer argument.static int invokeI2(long callContext, long function, int arg1, int arg2)
callContext
- The address of the call context structure from newCallContext(long, long[], int)
.function
- The address of the function to invoke.arg1
- The first 32 bit integer argument.arg2
- The second 32 bit integer argument.static int invokeI2NoErrno(long callContext, long function, int arg1, int arg2)
callContext
- The address of the call context structure from newCallContext(long, long[], int)
.function
- The address of the function to invoke.arg1
- The first 32 bit integer argument.arg2
- The second 32 bit integer argument.static int invokeI3(long callContext, long function, int arg1, int arg2, int arg3)
callContext
- The address of the call context structure from newCallContext(long, long[], int)
.function
- The address of the function to invoke.arg1
- The first 32 bit integer argument.arg2
- The second 32 bit integer argument.arg3
- The third 32 bit integer argument.static int invokeI4(long callContext, long function, int arg1, int arg2, int arg3, int arg4)
callContext
- The address of the call context structure from newCallContext(long, long[], int)
.function
- The address of the function to invoke.arg1
- The first 32 bit integer argument.arg2
- The second 32 bit integer argument.arg3
- The third 32 bit integer argument.arg4
- The third 32 bit integer argument.static int invokeI5(long callContext, long function, int arg1, int arg2, int arg3, int arg4, int arg5)
callContext
- The address of the call context structure from newCallContext(long, long[], int)
.function
- The address of the function to invoke.arg1
- The first 32 bit integer argument.arg2
- The second 32 bit integer argument.arg3
- The third 32 bit integer argument.arg4
- The fourth 32 bit integer argument.arg5
- The fifth 32 bit integer argument.static int invokeI6(long callContext, long function, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6)
callContext
- The address of the call context structure from newCallContext(long, long[], int)
.function
- The address of the function to invoke.arg1
- The first 32 bit integer argument.arg2
- The second 32 bit integer argument.arg3
- The third 32 bit integer argument.arg4
- The fourth 32 bit integer argument.arg5
- The fifth 32 bit integer argument.arg6
- The sixth 32 bit integer argument.static int invokeI3NoErrno(long callContext, long function, int arg1, int arg2, int arg3)
callContext
- The address of the call context structure from newCallContext(long, long[], int)
.function
- The address of the function to invoke.arg1
- The first 32 bit integer argument.arg2
- The second 32 bit integer argument.arg3
- The third 32 bit integer argument.static int invokeI4NoErrno(long callContext, long function, int arg1, int arg2, int arg3, int arg4)
static int invokeI5NoErrno(long callContext, long function, int arg1, int arg2, int arg3, int arg4, int arg5)
static int invokeI6NoErrno(long callContext, long function, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6)
static long invokeL0(long ctx, long function)
function
- The address of the function context structure from newCallContext(long, long[], int)
.static long invokeL1(long ctx, long function, long arg1)
function
- The address of the function context structure from newCallContext(long, long[], int)
.arg1
- The 64 bit integer argument.static long invokeL2(long ctx, long function, long arg1, long arg2)
function
- The address of the function context structure from newCallContext(long, long[], int)
.arg1
- The first 64 bit integer argument.arg2
- The second 64 bit integer argument.static long invokeL3(long ctx, long function, long arg1, long arg2, long arg3)
function
- The address of the function context structure from newCallContext(long, long[], int)
.arg1
- The first 64 bit integer argument.arg2
- The second 64 bit integer argument.arg3
- The third 64 bit integer argument.static long invokeL4(long ctx, long function, long arg1, long arg2, long arg3, long arg4)
function
- The address of the function context structure from newCallContext(long, long[], int)
.arg1
- The first 64 bit integer argument.arg2
- The second 64 bit integer argument.arg3
- The third 64 bit integer argument.arg4
- The fourth 64 bit integer argument.static long invokeL5(long ctx, long function, long arg1, long arg2, long arg3, long arg4, long arg5)
function
- The address of the function context structure from newCallContext(long, long[], int)
.arg1
- The first 64 bit integer argument.arg2
- The second 64 bit integer argument.arg3
- The third 64 bit integer argument.arg4
- The fourth 64 bit integer argument.arg5
- The fifth 64 bit integer argument.static long invokeL6(long ctx, long function, long arg1, long arg2, long arg3, long arg4, long arg5, long arg6)
function
- The address of the function context structure from newCallContext(long, long[], int)
.arg1
- The first 64 bit integer argument.arg2
- The second 64 bit integer argument.arg3
- The third 64 bit integer argument.arg4
- The fourth 64 bit integer argument.arg5
- The fifth 64 bit integer argument.arg6
- The sixth 64 bit integer argument.static long invokeL0NoErrno(long ctx, long function)
static long invokeL1NoErrno(long ctx, long function, long arg1)
static long invokeL2NoErrno(long ctx, long function, long arg1, long arg2)
static long invokeL3NoErrno(long ctx, long function, long arg1, long arg2, long arg3)
static long invokeL4NoErrno(long ctx, long function, long arg1, long arg2, long arg3, long arg4)
static long invokeL5NoErrno(long ctx, long function, long arg1, long arg2, long arg3, long arg4, long arg5)
static long invokeL6NoErrno(long ctx, long function, long arg1, long arg2, long arg3, long arg4, long arg5, long arg6)
static long invokeN0(long ctx, long function)
function
- The address of the function context structure from newCallContext(long, long[], int)
.static long invokeN1(long ctx, long function, long arg1)
function
- The address of the function context structure from newCallContext(long, long[], int)
.arg1
- The first numeric argument.static long invokeN2(long ctx, long function, long arg1, long arg2)
function
- The address of the function context structure from newCallContext(long, long[], int)
.arg1
- The first numeric argument.arg2
- The second numeric argument.static long invokeN3(long ctx, long function, long arg1, long arg2, long arg3)
function
- The address of the function context structure from newCallContext(long, long[], int)
.arg1
- The first numeric argument.arg2
- The second numeric argument.arg3
- The third numeric argument.static long invokeN4(long ctx, long function, long arg1, long arg2, long arg3, long arg4)
function
- The address of the function context structure from newCallContext(long, long[], int)
.arg1
- The first numeric argument.arg2
- The second numeric argument.arg3
- The third numeric argument.arg4
- The fourth numeric argument.static long invokeN5(long ctx, long function, long arg1, long arg2, long arg3, long arg4, long arg5)
function
- The address of the function context structure from newCallContext(long, long[], int)
.arg1
- The first numeric argument.arg2
- The second numeric argument.arg3
- The third numeric argument.arg4
- The fourth numeric argument.arg5
- The fifth numeric argument.static long invokeN6(long ctx, long function, long arg1, long arg2, long arg3, long arg4, long arg5, long arg6)
function
- The address of the function context structure from newCallContext(long, long[], int)
.arg1
- The first numeric argument.arg2
- The second numeric argument.arg3
- The third numeric argument.arg4
- The fourth numeric argument.arg5
- The fifth numeric argument.arg6
- The sixth numeric argument.static long invokeN1O1(long callContext, long functionAddress, long n1, java.lang.Object o1, int o1flags, int o1off, int o1len)
callContext
- The FFI call context describing the function to invoke.functionAddress
- The native function to invoke.n1
- The first numeric argument.o1
- An Object (array or buffer), to be passed as a pointer.o1flags
- Object flags (direction, type, idx).o1off
- The offset from the start of the array or buffer.o1len
- The length of the array to use.static long invokeN2O1(long callContext, long functionAddress, long n1, long n2, java.lang.Object o1, int o1flags, int o1off, int o1len)
callContext
- The FFI call context describing the function to invoke.functionAddress
- The native function to invoke.n1
- The first numeric argument.n2
- The second numeric argument.o1
- An Object (array or buffer), to be passed as a pointer.o1flags
- Object flags (direction, type, idx).o1off
- The offset from the start of the array or buffer.o1len
- The length of the array to use.static long invokeN2O2(long callContext, long functionAddress, long n1, long n2, java.lang.Object o1, int o1flags, int o1off, int o1len, java.lang.Object o2, int o2flags, int o2off, int o2len)
callContext
- The FFI call context describing the function to invoke.functionAddress
- The native function to invoke.n1
- The first numeric argument.n2
- The second numeric argument.o1
- An Object (array or buffer), to be passed as a pointer.o1off
- The offset from the start of the array or buffer.o1len
- The length of the array to use.o1flags
- Object flags (direction, type, idx).o2
- An Object (array or buffer), to be passed as a pointer.o2off
- The offset from the start of the array or buffer.o2len
- The length of the array to use.o2flags
- Object flags (direction, type, idx).static long invokeN3O1(long callContext, long functionAddress, long n1, long n2, long n3, java.lang.Object o1, int o1flags, int o1off, int o1len)
callContext
- The FFI call context describing the function to invoke.functionAddress
- The native function to invoke.n1
- The first numeric argument.n2
- The second numeric argument.n3
- The third numeric argument.o1
- An Object (array or buffer), to be passed as a pointer.o1off
- The offset from the start of the array or buffer.o1len
- The length of the array to use.o1flags
- Object flags (direction, type, parameter index).static long invokeN3O2(long callContext, long functionAddress, long n1, long n2, long n3, java.lang.Object o1, int o1flags, int o1off, int o1len, java.lang.Object o2, int o2flags, int o2off, int o2len)
static long invokeN3O3(long callContext, long functionAddress, long n1, long n2, long n3, java.lang.Object o1, int o1flags, int o1off, int o1len, java.lang.Object o2, int o2flags, int o2off, int o2len, java.lang.Object o3, int o3flags, int o3off, int o3len)
static long invokeN4O1(long callContext, long functionAddress, long n1, long n2, long n3, long n4, java.lang.Object o1, int o1flags, int o1off, int o1len)
static long invokeN4O2(long callContext, long functionAddress, long n1, long n2, long n3, long n4, java.lang.Object o1, int o1flags, int o1off, int o1len, java.lang.Object o2, int o2flags, int o2off, int o2len)
static long invokeN4O3(long callContext, long functionAddress, long n1, long n2, long n3, long n4, java.lang.Object o1, int o1flags, int o1off, int o1len, java.lang.Object o2, int o2flags, int o2off, int o2len, java.lang.Object o3, int o3flags, int o3off, int o3len)
static long invokeN4O4(long callContext, long functionAddress, long n1, long n2, long n3, long n4, java.lang.Object o1, int o1flags, int o1off, int o1len, java.lang.Object o2, int o2flags, int o2off, int o2len, java.lang.Object o3, int o3flags, int o3off, int o3len, java.lang.Object o4, int o4flags, int o4off, int o4len)
static long invokeN5O1(long callContext, long functionAddress, long n1, long n2, long n3, long n4, long n5, java.lang.Object o1, int o1flags, int o1off, int o1len)
static long invokeN5O2(long callContext, long functionAddress, long n1, long n2, long n3, long n4, long n5, java.lang.Object o1, int o1flags, int o1off, int o1len, java.lang.Object o2, int o2flags, int o2off, int o2len)
static long invokeN5O3(long callContext, long functionAddress, long n1, long n2, long n3, long n4, long n5, java.lang.Object o1, int o1flags, int o1off, int o1len, java.lang.Object o2, int o2flags, int o2off, int o2len, java.lang.Object o3, int o3flags, int o3off, int o3len)
static long invokeN5O4(long callContext, long functionAddress, long n1, long n2, long n3, long n4, long n5, java.lang.Object o1, int o1flags, int o1off, int o1len, java.lang.Object o2, int o2flags, int o2off, int o2len, java.lang.Object o3, int o3flags, int o3off, int o3len, java.lang.Object o4, int o4flags, int o4off, int o4len)
static long invokeN5O5(long callContext, long functionAddress, long n1, long n2, long n3, long n4, long n5, java.lang.Object o1, int o1flags, int o1off, int o1len, java.lang.Object o2, int o2flags, int o2off, int o2len, java.lang.Object o3, int o3flags, int o3off, int o3len, java.lang.Object o4, int o4flags, int o4off, int o4len, java.lang.Object o5, int o5flags, int o5off, int o5len)
static long invokeN6O1(long callContext, long functionAddress, long n1, long n2, long n3, long n4, long n5, long n6, java.lang.Object o1, int o1flags, int o1off, int o1len)
static long invokeN6O2(long callContext, long functionAddress, long n1, long n2, long n3, long n4, long n5, long n6, java.lang.Object o1, int o1flags, int o1off, int o1len, java.lang.Object o2, int o2flags, int o2off, int o2len)
static long invokeN6O3(long callContext, long functionAddress, long n1, long n2, long n3, long n4, long n5, long n6, java.lang.Object o1, int o1flags, int o1off, int o1len, java.lang.Object o2, int o2flags, int o2off, int o2len, java.lang.Object o3, int o3flags, int o3off, int o3len)
static long invokeN6O4(long callContext, long functionAddress, long n1, long n2, long n3, long n4, long n5, long n6, java.lang.Object o1, int o1flags, int o1off, int o1len, java.lang.Object o2, int o2flags, int o2off, int o2len, java.lang.Object o3, int o3flags, int o3off, int o3len, java.lang.Object o4, int o4flags, int o4off, int o4len)
static long invokeN6O5(long callContext, long functionAddress, long n1, long n2, long n3, long n4, long n5, long n6, java.lang.Object o1, int o1flags, int o1off, int o1len, java.lang.Object o2, int o2flags, int o2off, int o2len, java.lang.Object o3, int o3flags, int o3off, int o3len, java.lang.Object o4, int o4flags, int o4off, int o4len, java.lang.Object o5, int o5flags, int o5off, int o5len)
static long invokeN6O6(long callContext, long functionAddress, long n1, long n2, long n3, long n4, long n5, long n6, java.lang.Object o1, int o1flags, int o1off, int o1len, java.lang.Object o2, int o2flags, int o2off, int o2len, java.lang.Object o3, int o3flags, int o3off, int o3len, java.lang.Object o4, int o4flags, int o4off, int o4len, java.lang.Object o5, int o5flags, int o5off, int o5len, java.lang.Object o6, int o6flags, int o6off, int o6len)
static int invokeArrayReturnInt(long callContext, long function, byte[] buffer)
callContext
- The address of the call context structure from newCallContext(long, long[], int)
.buffer
- A byte array containing the arguments to the function.static long invokeArrayReturnLong(long callContext, long function, byte[] buffer)
callContext
- The address of the call context structure from newCallContext(long, long[], int)
.function
- The address of the function to invoke.buffer
- A byte array containing the arguments to the function.static float invokeArrayReturnFloat(long callContext, long function, byte[] buffer)
callContext
- The address of the call context structure from newCallContext(long, long[], int)
.function
- The address of the function to invoke.buffer
- A byte array containing the arguments to the function.static double invokeArrayReturnDouble(long callContext, long function, byte[] buffer)
callContext
- The address of the call context structure from newCallContext(long, long[], int)
.function
- The address of the function to invoke.buffer
- A byte array containing the arguments to the function.static void invokeArrayReturnStruct(long callContext, long function, byte[] paramBuffer, byte[] returnBuffer, int offset)
callContext
- The address of the call context structure from newCallContext(long, long[], int)
.function
- The address of the function to invoke.paramBuffer
- A byte array containing the arguments to the function.static java.lang.Object invokeArrayWithObjectsReturnObject(long callContext, long function, byte[] paramBuffer, int objectCount, int[] objectInfo, java.lang.Object[] objects)
callContext
- The address of the call context structure from newCallContext(long, long[], int)
.function
- The address of the function to invoke.paramBuffer
- A byte array containing the arguments to the function.static int invokeArrayWithObjectsInt32(long callContext, long function, byte[] buffer, int objectCount, int[] objectInfo, java.lang.Object[] objects)
static long invokeArrayWithObjectsInt64(long callContext, long function, byte[] buffer, int objectCount, int[] objectInfo, java.lang.Object[] objects)
static float invokeArrayWithObjectsFloat(long callContext, long function, byte[] buffer, int objectCount, int[] objectInfo, java.lang.Object[] objects)
static double invokeArrayWithObjectsDouble(long callContext, long function, byte[] buffer, int objectCount, int[] objectInfo, java.lang.Object[] objects)
static void invokeArrayWithObjectsReturnStruct(long callContext, long function, byte[] buffer, int objectCount, int[] objectInfo, java.lang.Object[] objects, byte[] returnBuffer, int returnBufferOffset)
static int invokeArrayO1Int32(long callContext, long function, byte[] buffer, java.lang.Object o1, int o1Info, int o1off, int o1len)
static int invokeArrayO2Int32(long callContext, long function, byte[] buffer, java.lang.Object o1, int o1Info, int o1off, int o1len, java.lang.Object o2, int o2info, int o2off, int o2len)
static long invokeArrayO1Int64(long callContext, long function, byte[] buffer, java.lang.Object o1, int o1Info, int o1off, int o1len)
static long invokeArrayO2Int64(long callContext, long function, byte[] buffer, java.lang.Object o1, int o1Info, int o1off, int o1len, java.lang.Object o2, int o2info, int o2off, int o2len)
static void invokePointerParameterArray(long callContext, long functionContext, long returnBuffer, long[] parameters)
functionContext
- The address of the function context structure from newCallContext(long, long[], int)
.returnBuffer
- The address of the native buffer to place the result
of the function call in.parameters
- An array of addresses of the function parameters.static byte getByte(long address)
address
- The memory location to get the value from.static short getShort(long address)
address
- The memory location to get the value from.static int getInt(long address)
address
- The memory location to get the value from.static long getLong(long address)
address
- The memory location to get the value from.static float getFloat(long address)
address
- The memory location to get the value from.static double getDouble(long address)
address
- The memory location to get the value from.static long getAddress(long address)
address
- The memory location to get the value from.static void putByte(long address, byte value)
address
- The memory location to put the value.value
- The value to write to memory.static void putShort(long address, short value)
address
- The memory location to put the value.value
- The value to write to memory.static void putInt(long address, int value)
address
- The memory location to put the value.value
- The value to write to memory.static void putLong(long address, long value)
address
- The memory location to put the value.value
- The value to write to memory.static void putFloat(long address, float value)
address
- The memory location to put the value.value
- The value to write to memory.static void putDouble(long address, double value)
address
- The memory location to put the value.value
- The value to write to memory.static void putAddress(long address, long value)
address
- The memory location to put the value.value
- The value to write to memory.static void setMemory(long address, long size, byte value)
address
- The address of start of the native memory.size
- The number of bytes to set.value
- The value to set the native memory to.static void copyMemory(long src, long dst, long size)
src
- The source memory address.dst
- The destination memory address.size
- The number of bytes to copy.static void putByteArray(long address, byte[] data, int offset, int length)
address
- The native memory address to copy the array to.data
- The java array to copy.offset
- The offset within the array to start copying from.length
- The number of array elements to copy.static void getByteArray(long address, byte[] data, int offset, int length)
address
- The native memory address to copy the array from.data
- The java array to copy.offset
- The offset within the array to start copying to.length
- The number of array elements to copy.static void putCharArray(long address, char[] data, int offset, int length)
address
- The native memory address to copy the array to.data
- The java array to copy.offset
- The offset within the array to start copying from.length
- The number of array elements to copy.static void getCharArray(long address, char[] data, int offset, int length)
address
- The native memory address to copy the array from.data
- The java array to copy.offset
- The offset within the array to start copying to.length
- The number of array elements to copy.static void putShortArray(long address, short[] data, int offset, int length)
address
- The native memory address to copy the array to.data
- The java array to copy.offset
- The offset within the array to start copying from.length
- The number of array elements to copy.static void getShortArray(long address, short[] data, int offset, int length)
address
- The native memory address to copy the array from.data
- The java array to copy.offset
- The offset within the array to start copying to.length
- The number of array elements to copy.static void putIntArray(long address, int[] data, int offset, int length)
address
- The native memory address to copy the array to.data
- The java array to copy.offset
- The offset within the array to start copying from.length
- The number of array elements to copy.static void getIntArray(long address, int[] data, int offset, int length)
address
- The native memory address to copy the array from.data
- The java array to copy.offset
- The offset within the array to start copying to.length
- The number of array elements to copy.static void putLongArray(long address, long[] data, int offset, int length)
address
- The native memory address to copy the array to.data
- The java array to copy.offset
- The offset within the array to start copying from.length
- The number of array elements to copy.static void getLongArray(long address, long[] data, int offset, int length)
address
- The native memory address to copy the array from.data
- The java array to copy.offset
- The offset within the array to start copying to.length
- The number of array elements to copy.static void putFloatArray(long address, float[] data, int offset, int length)
address
- The native memory address to copy the array to.data
- The java array to copy.offset
- The offset within the array to start copying from.length
- The number of array elements to copy.static void getFloatArray(long address, float[] data, int offset, int length)
address
- The native memory address to copy the array from.data
- The java array to copy.offset
- The offset within the array to start copying to.length
- The number of array elements to copy.static void putDoubleArray(long address, double[] data, int offset, int length)
address
- The native memory address to copy the array to.data
- The java array to copy.offset
- The offset within the array to start copying from.length
- The number of array elements to copy.static void getDoubleArray(long address, double[] data, int offset, int length)
address
- The native memory address to copy the array from.data
- The java array to copy.offset
- The offset within the array to start copying to.length
- The number of array elements to copy.static long memchr(long address, int value, long len)
address
- The native memory address to start searching.value
- The value to search for.len
- The size of the native memory region being searched.static void memmove(long dst, long src, long len)
dst
- The destination memory address.src
- The source memory address.len
- The number of bytes to copy.static void memcpy(long dst, long src, long len)
dst
- The destination memory address.src
- The source memory address.len
- The number of bytes to copy.static long strlen(long address)
address
- The native address of the string.static byte[] getZeroTerminatedByteArray(long address)
address
- The address to copy the array fromstatic byte[] getZeroTerminatedByteArray(long address, int maxlen)
address
- The address to copy the array frommaxlen
- The maximum number of bytes to search for the nul terminatorstatic void putZeroTerminatedByteArray(long address, byte[] data, int offset, int length)
address
- The address to copy to.data
- The byte array to copy to native memoryoffset
- The offset within the byte array to begin copying fromlength
- The number of bytes to copy to native memorystatic byte getByteChecked(long address)
address
- The memory location to get the value from.static short getShortChecked(long address)
address
- The memory location to get the value from.static int getIntChecked(long address)
address
- The memory location to get the value from.static long getLongChecked(long address)
address
- The memory location to get the value from.static float getFloatChecked(long address)
address
- The memory location to get the value from.static double getDoubleChecked(long address)
address
- The memory location to get the value from.static long getAddressChecked(long address)
address
- The memory location to get the value from.static void putByteChecked(long address, byte value)
address
- The memory location to put the value.value
- The value to write to memory.static void putShortChecked(long address, short value)
address
- The memory location to put the value.value
- The value to write to memory.static void putIntChecked(long address, int value)
address
- The memory location to put the value.value
- The value to write to memory.static void putLongChecked(long address, long value)
address
- The memory location to put the value.value
- The value to write to memory.static void putFloatChecked(long address, float value)
address
- The memory location to put the value.value
- The value to write to memory.static void putDoubleChecked(long address, double value)
address
- The memory location to put the value.value
- The value to write to memory.static void putAddressChecked(long address, long value)
address
- The memory location to put the value.value
- The value to write to memory.static void setMemoryChecked(long address, long size, byte value)
address
- The address of start of the native memory.size
- The number of bytes to set.value
- The value to set the native memory to.static void copyMemoryChecked(long src, long dst, long size)
src
- The source memory address.dst
- The destination memory address.size
- The number of bytes to copy.static void putByteArrayChecked(long address, byte[] data, int offset, int length)
address
- The native memory address to copy the array to.data
- The java array to copy.offset
- The offset within the array to start copying from.length
- The number of array elements to copy.static void getByteArrayChecked(long address, byte[] data, int offset, int length)
address
- The native memory address to copy the array from.data
- The java array to copy.offset
- The offset within the array to start copying to.length
- The number of array elements to copy.static void putCharArrayChecked(long address, char[] data, int offset, int length)
address
- The native memory address to copy the array to.data
- The java array to copy.offset
- The offset within the array to start copying from.length
- The number of array elements to copy.static void getCharArrayChecked(long address, char[] data, int offset, int length)
address
- The native memory address to copy the array from.data
- The java array to copy.offset
- The offset within the array to start copying to.length
- The number of array elements to copy.static void putShortArrayChecked(long address, short[] data, int offset, int length)
address
- The native memory address to copy the array to.data
- The java array to copy.offset
- The offset within the array to start copying from.length
- The number of array elements to copy.static void getShortArrayChecked(long address, short[] data, int offset, int length)
address
- The native memory address to copy the array from.data
- The java array to copy.offset
- The offset within the array to start copying to.length
- The number of array elements to copy.static void putIntArrayChecked(long address, int[] data, int offset, int length)
address
- The native memory address to copy the array to.data
- The java array to copy.offset
- The offset within the array to start copying from.length
- The number of array elements to copy.static void getIntArrayChecked(long address, int[] data, int offset, int length)
address
- The native memory address to copy the array from.data
- The java array to copy.offset
- The offset within the array to start copying to.length
- The number of array elements to copy.static void putLongArrayChecked(long address, long[] data, int offset, int length)
address
- The native memory address to copy the array to.data
- The java array to copy.offset
- The offset within the array to start copying from.length
- The number of array elements to copy.static void getLongArrayChecked(long address, long[] data, int offset, int length)
address
- The native memory address to copy the array from.data
- The java array to copy.offset
- The offset within the array to start copying to.length
- The number of array elements to copy.static void putFloatArrayChecked(long address, float[] data, int offset, int length)
address
- The native memory address to copy the array to.data
- The java array to copy.offset
- The offset within the array to start copying from.length
- The number of array elements to copy.static void getFloatArrayChecked(long address, float[] data, int offset, int length)
address
- The native memory address to copy the array from.data
- The java array to copy.offset
- The offset within the array to start copying to.length
- The number of array elements to copy.static void putDoubleArrayChecked(long address, double[] data, int offset, int length)
address
- The native memory address to copy the array to.data
- The java array to copy.offset
- The offset within the array to start copying from.length
- The number of array elements to copy.static void getDoubleArrayChecked(long address, double[] data, int offset, int length)
address
- The native memory address to copy the array from.data
- The java array to copy.offset
- The offset within the array to start copying to.length
- The number of array elements to copy.static long memchrChecked(long address, int value, long len)
address
- The native memory address to start searching.value
- The value to search for.len
- The size of the native memory region being searched.static void memmoveChecked(long dst, long src, long len)
dst
- The destination memory address.src
- The source memory address.len
- The number of bytes to copy.static void memcpyChecked(long dst, long src, long len)
dst
- The destination memory address.src
- The source memory address.len
- The number of bytes to copy.static long strlenChecked(long address)
address
- The native address of the string.static byte[] getZeroTerminatedByteArrayChecked(long address)
address
- The address to copy the array fromstatic byte[] getZeroTerminatedByteArrayChecked(long address, int maxlen)
address
- The address to copy the array frommaxlen
- The maximum number of bytes to search for the nul terminatorstatic void putZeroTerminatedByteArrayChecked(long address, byte[] data, int offset, int length)
address
- The address to copy to.data
- The byte array to copy to native memoryoffset
- The offset within the byte array to begin copying fromlength
- The number of bytes to copy to native memoryfinal java.nio.ByteBuffer newDirectByteBuffer(long address, int capacity)
address
- The start of the native memory region.capacity
- The size of the native memory region.final long getDirectBufferAddress(java.nio.Buffer buffer)
buffer
- A direct ByteBuffer to get the address of.final void longDoubleFromDouble(double doubleValue, byte[] buf, int off, int len)
final double longDoubleToDouble(byte[] buf, int off, int len)
final void longDoubleFromString(java.lang.String doubleString, byte[] buf, int off, int len)
final java.lang.String longDoubleToString(byte[] buf, int off, int len)
final java.lang.String longDoubleToEngineeringString(byte[] buf, int off, int len)
final java.lang.String longDoubleToPlainString(byte[] buf, int off, int len)
final long newNativeMethod(java.lang.String name, java.lang.String signature, long functionContext)
final void freeNativeMethod(long handle)
final long compileNativeMethods(long[] methods)
final void freeCompiledMethods(long handle)
final boolean registerNativeMethods(java.lang.Class clazz, long handle)
clazz
- The java class to register the native methods onhandle
- The handle returned from compileNativeMethodsfinal void unregisterNativeMethods(java.lang.Class clazz)
final long getSaveErrnoFunction()
final void setCallContextErrorFunction(long ctx, long fn)
final long getSaveErrnoCtxFunction()
final int getJNIVersion()
final long getJavaVM()
final void fatalError(java.lang.String msg)
final java.lang.Class defineClass(java.lang.String name, java.lang.Object loader, byte[] buf, int off, int len)
final java.lang.Class defineClass(java.lang.String name, java.lang.Object loader, java.nio.ByteBuffer buf)
final java.lang.Object allocObject(java.lang.Class clazz)
final int registerNatives(java.lang.Class clazz, long methods, int methodCount)
final int unregisterNatives(java.lang.Class clazz)
final java.lang.String getArch()