Package com.kenai.jffi
Class Foreign
java.lang.Object
com.kenai.jffi.Foreign
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static final class
private static final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Default calling conventionstatic final int
Do not save errno after each callstatic final int
Try to capture segmentation faults and convert to java exceptionsstatic final int
Windows STDCALL calling conventionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
Use the specified addressstatic final int
static final int
static final int
Share changesstatic final int
Code segment memorystatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
Win32 VirtualAlloc/VirtualProtect flagsstatic final int
static final int
static final int
static final int
Pages can be executedstatic final int
Pages cannot be accessedstatic final int
Pages can be readstatic final int
Pages can be writtenstatic final int
All symbols in the library are made available to other librariesstatic final int
Perform lazy binding.static final int
Symbols in this library are not made available to other librariesstatic final int
Resolve all symbols when loading the librarystatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static long
allocateMemory
(long size, boolean clear) Allocates native memory.(package private) final Object
allocObject
(Class clazz) (package private) final long
closureMagazineGet
(long closurePool, Object proxy) (package private) final 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) final Class
defineClass
(String name, Object loader, byte[] buf, int off, int len) (package private) final Class
defineClass
(String name, Object loader, ByteBuffer buf) (package private) static void
dlclose
(long handle) Closes a dynamic library opened bydlopen(java.lang.String, int)
.(package private) static String
dlerror()
Gets the last error raised bydlopen(java.lang.String, int)
ordlsym(long, java.lang.String)
(package private) static long
Opens a dynamic library.(package private) static long
Locates the memory address of a dynamic library symbol.(package private) final void
fatalError
(String msg) (package private) final void
freeAggregate
(long handle) Frees a FFI struct, union or array handle allocated vianewStruct(long[], boolean)
ornewArray(long, int)
.(package private) final void
freeCallContext
(long callContext) Frees a call context created bynewCallContext(long, long[], int)
(package private) final void
freeClosureMagazine
(long closurePool) (package private) final void
freeCompiledMethods
(long handle) (package private) static void
freeMemory
(long address) Releases memory allocated viaallocateMemory(long, boolean)
back to the system.(package private) final 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) final 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) final 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) final long
getDirectBufferAddress
(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
(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) final long
(package private) final int
(package private) static int
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) final long
(package private) final long
(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) final int
getTypeAlign
(long handle) Gets the minimum required alignment of the FFI type(package private) final int
getTypeSize
(long handle) Gets the native size of the type(package private) final int
getTypeType
(long handle) Gets the primitive type enum for the FFI type(package private) final int
Gets the native stub library version.private static int
getVersionField
(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, Object o1, int o1Info, int o1off, int o1len) (package private) static long
invokeArrayO1Int64
(long callContext, long function, byte[] buffer, Object o1, int o1Info, int o1off, int o1len) (package private) static int
invokeArrayO2Int32
(long callContext, long function, byte[] buffer, Object o1, int o1Info, int o1off, int o1len, Object o2, int o2info, int o2off, int o2len) (package private) static long
invokeArrayO2Int64
(long callContext, long function, byte[] buffer, Object o1, int o1Info, int o1off, int o1len, 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, Object[] objects) (package private) static float
invokeArrayWithObjectsFloat
(long callContext, long function, byte[] buffer, int objectCount, int[] objectInfo, Object[] objects) (package private) static int
invokeArrayWithObjectsInt32
(long callContext, long function, byte[] buffer, int objectCount, int[] objectInfo, Object[] objects) (package private) static long
invokeArrayWithObjectsInt64
(long callContext, long function, byte[] buffer, int objectCount, int[] objectInfo, Object[] objects) (package private) static Object
invokeArrayWithObjectsReturnObject
(long callContext, long function, byte[] paramBuffer, int objectCount, int[] objectInfo, 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, 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, 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, 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, Object o1, int o1flags, int o1off, int o1len, 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, 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, Object o1, int o1flags, int o1off, int o1len, Object o2, int o2flags, int o2off, int o2len) (package private) static long
invokeN3O3
(long callContext, long functionAddress, long n1, long n2, long n3, Object o1, int o1flags, int o1off, int o1len, Object o2, int o2flags, int o2off, int o2len, 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, 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, Object o1, int o1flags, int o1off, int o1len, 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, Object o1, int o1flags, int o1off, int o1len, Object o2, int o2flags, int o2off, int o2len, 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, Object o1, int o1flags, int o1off, int o1len, Object o2, int o2flags, int o2off, int o2len, Object o3, int o3flags, int o3off, int o3len, 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, 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, Object o1, int o1flags, int o1off, int o1len, 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, Object o1, int o1flags, int o1off, int o1len, Object o2, int o2flags, int o2off, int o2len, 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, Object o1, int o1flags, int o1off, int o1len, Object o2, int o2flags, int o2off, int o2len, Object o3, int o3flags, int o3off, int o3len, 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, Object o1, int o1flags, int o1off, int o1len, Object o2, int o2flags, int o2off, int o2len, Object o3, int o3flags, int o3off, int o3len, Object o4, int o4flags, int o4off, int o4len, 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, 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, Object o1, int o1flags, int o1off, int o1len, 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, Object o1, int o1flags, int o1off, int o1len, Object o2, int o2flags, int o2off, int o2len, 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, Object o1, int o1flags, int o1off, int o1len, Object o2, int o2flags, int o2off, int o2len, Object o3, int o3flags, int o3off, int o3len, 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, Object o1, int o1flags, int o1off, int o1len, Object o2, int o2flags, int o2off, int o2len, Object o3, int o3flags, int o3off, int o3len, Object o4, int o4flags, int o4off, int o4len, 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, Object o1, int o1flags, int o1off, int o1len, Object o2, int o2flags, int o2off, int o2len, Object o3, int o3flags, int o3off, int o3len, Object o4, int o4flags, int o4off, int o4len, Object o5, int o5flags, int o5off, int o5len, 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
(package private) static boolean
(package private) final boolean
(package private) final void
longDoubleFromDouble
(double doubleValue, byte[] buf, int off, int len) (package private) final void
longDoubleFromString
(String doubleString, byte[] buf, int off, int len) (package private) final double
longDoubleToDouble
(byte[] buf, int off, int len) (package private) final String
longDoubleToEngineeringString
(byte[] buf, int off, int len) (package private) final String
longDoubleToPlainString
(byte[] buf, int off, int len) (package private) final String
longDoubleToString
(byte[] buf, int off, int len) (package private) final 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) final long
newArray
(long elementType, int length) Allocates a new FFI array type.(package private) final long
newCallContext
(long returnType, long[] paramTypes, int flags) Creates a new native call context.(package private) final long
newClosureMagazine
(long contextAddress, Method closureMethod, boolean callWithPrimitiveParameters) (package private) final ByteBuffer
newDirectByteBuffer
(long address, int capacity) Creates a new Direct ByteBuffer for a native memory region.private static UnsatisfiedLinkError
newLoadError
(Throwable cause) (package private) final long
newNativeMethod
(String name, String signature, long functionContext) (package private) final 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) final boolean
registerNativeMethods
(Class clazz, long handle) (package private) final int
registerNatives
(Class clazz, long methods, int methodCount) (package private) final 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) final void
unregisterNativeMethods
(Class clazz) (package private) final int
unregisterNatives
(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)
-
Field Details
-
VERSION_MAJOR
-
VERSION_MINOR
-
VERSION_MICRO
-
TYPE_VOID
- See Also:
-
TYPE_FLOAT
- See Also:
-
TYPE_DOUBLE
- See Also:
-
TYPE_LONGDOUBLE
- See Also:
-
TYPE_UINT8
- See Also:
-
TYPE_SINT8
- See Also:
-
TYPE_UINT16
- See Also:
-
TYPE_SINT16
- See Also:
-
TYPE_UINT32
- See Also:
-
TYPE_SINT32
- See Also:
-
TYPE_UINT64
- See Also:
-
TYPE_SINT64
- See Also:
-
TYPE_STRUCT
- See Also:
-
TYPE_POINTER
- See Also:
-
TYPE_UCHAR
- See Also:
-
TYPE_SCHAR
- See Also:
-
TYPE_USHORT
- See Also:
-
TYPE_SSHORT
- See Also:
-
TYPE_UINT
- See Also:
-
TYPE_SINT
- See Also:
-
TYPE_ULONG
- See Also:
-
TYPE_SLONG
- See Also:
-
RTLD_LAZY
Perform lazy binding. Only resolve symbols as needed- See Also:
-
RTLD_NOW
Resolve all symbols when loading the library- See Also:
-
RTLD_LOCAL
Symbols in this library are not made available to other libraries- See Also:
-
RTLD_GLOBAL
All symbols in the library are made available to other libraries- See Also:
-
PROT_READ
Pages can be read- See Also:
-
PROT_WRITE
Pages can be written- See Also:
-
PROT_EXEC
Pages can be executed- See Also:
-
PROT_NONE
Pages cannot be accessed- See Also:
-
MAP_SHARED
Share changes- See Also:
-
MAP_PRIVATE
- See Also:
-
MAP_FIXED
Use the specified address- See Also:
-
MAP_NORESERVE
- See Also:
-
MAP_ANON
- See Also:
-
MAP_ALIGN
- See Also:
-
MAP_TEXT
Code segment memory- See Also:
-
PAGE_NOACCESS
Win32 VirtualAlloc/VirtualProtect flags- See Also:
-
PAGE_READONLY
- See Also:
-
PAGE_READWRITE
- See Also:
-
PAGE_WRITECOPY
- See Also:
-
PAGE_EXECUTE
- See Also:
-
PAGE_EXECUTE_READ
- See Also:
-
PAGE_EXECUTE_READWRITE
- See Also:
-
PAGE_EXECUTE_WRITECOPY
- See Also:
-
MEM_COMMIT
- See Also:
-
MEM_RESERVE
- See Also:
-
MEM_DECOMMIT
- See Also:
-
MEM_RELEASE
- See Also:
-
MEM_FREE
- See Also:
-
MEM_PRIVATE
- See Also:
-
MEM_MAPPED
- See Also:
-
MEM_RESET
- See Also:
-
MEM_TOP_DOWN
- See Also:
-
MEM_PHYSICAL
- See Also:
-
MEM_4MB_PAGES
- See Also:
-
JNI_OK
public static final int JNI_OK- See Also:
-
JNI_ERR
public static final int JNI_ERR- See Also:
-
JNI_EDETACHED
public static final int JNI_EDETACHED- See Also:
-
JNI_EVERSION
public static final int JNI_EVERSION- See Also:
-
JNI_ENOMEM
public static final int JNI_ENOMEM- See Also:
-
JNI_EEXIST
public static final int JNI_EEXIST- See Also:
-
JNI_EINVAL
public static final int JNI_EINVAL- See Also:
-
F_DEFAULT
Default calling convention- See Also:
-
F_STDCALL
Windows STDCALL calling convention- See Also:
-
F_NOERRNO
Do not save errno after each call- See Also:
-
F_PROTECT
Try to capture segmentation faults and convert to java exceptions- See Also:
-
-
Constructor Details
-
Foreign
private Foreign()
-
-
Method Details
-
newLoadError
-
getInstance
-
getVersionField
-
getVersion
final int getVersion()Gets the native stub library version.- Returns:
- The version in the form of (VERSION_MAJOR invalid input: '<'invalid input: '<' 16 | VERSION_MINOR invalid input: '<'invalid input: '<' 8 | VERSION_MICRO)
-
init
private void init()Initializes any native method/field/class ids -
isFaultProtectionEnabled
private static boolean isFaultProtectionEnabled() -
isMemoryProtectionEnabled
static boolean isMemoryProtectionEnabled() -
dlopen
Opens a dynamic library. This is a very thin wrapper around the native dlopen(3) call.- Parameters:
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 ofRTLD_LAZY
,RTLD_NOW
,RTLD_LOCAL
,RTLD_GLOBAL
- Returns:
- A native handle to the dynamic library.
-
dlclose
static void dlclose(long handle) Closes a dynamic library opened bydlopen(java.lang.String, int)
.- Parameters:
handle
- The dynamic library handle returned bydlopen(java.lang.String, int)
-
dlsym
Locates the memory address of a dynamic library symbol.- Parameters:
handle
- A dynamic library handle obtained fromdlopen(java.lang.String, int)
name
- The name of the symbol.- Returns:
- The address where the symbol in loaded in memory.
-
dlerror
Gets the last error raised bydlopen(java.lang.String, int)
ordlsym(long, java.lang.String)
- Returns:
- The error string.
-
allocateMemory
static long allocateMemory(long size, boolean clear) Allocates native memory.- Parameters:
size
- The number of bytes of memory to allocateclear
- Whether the memory should be cleared (each byte set to zero).- Returns:
- The native address of the allocated memory.
-
freeMemory
static void freeMemory(long address) Releases memory allocated viaallocateMemory(long, boolean)
back to the system.- Parameters:
address
- The address of the memory to release.
-
pageSize
static long pageSize()Gets the size of a page of memory.- Returns:
- The size of a memory page in bytes.
-
mmap
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.- Parameters:
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
-- Returns:
- The address of the mapping on success, -1 on error.
-
munmap
static int munmap(long addr, long len) Calls the Unix munmap(2) function.- Parameters:
addr
- The address to unmap.len
- The size of the region.- Returns:
- 0 on success, -1 on error.
-
mprotect
static int mprotect(long addr, long len, int prot) Calls the Unix mprotect(2) function.- Parameters:
addr
- The address to unmap.len
- The size of the region.prot
- The new protection mode.- Returns:
- 0 on success, -1 on error.
-
VirtualAlloc
static long VirtualAlloc(long addr, int size, int flags, int prot) -
VirtualFree
static boolean VirtualFree(long addr, int size, int flags) -
VirtualProtect
static boolean VirtualProtect(long addr, int size, int prot) -
newCallContext
final long newCallContext(long returnType, long[] paramTypes, int flags) Creates a new native call context. To allow calling variadic FFI logic, the number of fixed arguments is passed in the high word of the flags parameter. Older builds that do not use the variadic logic will ignore these bits and continue to use the non- variadic logic that already worked. This change was primarily made for Apple Silicon, which handles variadic arguments differently than other platforms.- Parameters:
returnType
- The return type of the functionparamTypes
- The types of the parametersflags
- A bitmask of F_DEFAULT, F_STDCALL, F_NOERRNO, F_PROTECT and the fixed param count in the high word.- Returns:
- The native address of a new function context
-
freeCallContext
final void freeCallContext(long callContext) Frees a call context created bynewCallContext(long, long[], int)
- Parameters:
callContext
- The native call context to free
-
getCallContextRawParameterSize
final int getCallContextRawParameterSize(long callContext) Gets the size required to pack parameters for the function in libffi raw format.- Parameters:
callContext
- The call context- Returns:
- The size in bytes required to pack parameters in raw format
-
isRawParameterPackingEnabled
final boolean isRawParameterPackingEnabled() -
getLastError
static int getLastError()Gets the last error returned by a native function- Returns:
- An integer.
-
setLastError
static void setLastError(int error) Sets the native errno value- Parameters:
error
- The value to set errno to.
-
newClosureMagazine
final long newClosureMagazine(long contextAddress, Method closureMethod, boolean callWithPrimitiveParameters) -
freeClosureMagazine
final void freeClosureMagazine(long closurePool) -
closureMagazineGet
-
lookupBuiltinType
final long lookupBuiltinType(int type) Gets the address of the ffi_type structure for the builtin type- Parameters:
type
- The FFI type enum value- Returns:
- The address of the ffi_type struct for this type, or
null
-
getTypeSize
final int getTypeSize(long handle) Gets the native size of the type- Parameters:
handle
- Address of the type structure- Returns:
- The native size of the type
-
getTypeAlign
final int getTypeAlign(long handle) Gets the minimum required alignment of the FFI type- Parameters:
handle
- Address of the type structure- Returns:
- The minimum required alignment
-
getTypeType
final int getTypeType(long handle) Gets the primitive type enum for the FFI type- Parameters:
handle
- Address of the type structure- Returns:
- The builtin primitive type of the type structure
-
newStruct
final long newStruct(long[] fields, boolean isUnion) Allocates a new FFI struct or union layout- Parameters:
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.- Returns:
- The native address of the ffi_type structure for the new struct layout
- See Also:
-
newArray
final long newArray(long elementType, int length) Allocates a new FFI array type.- Parameters:
elementType
- the type of each element in the array.length
- the number of elements in the array.- Returns:
- The native address of the ffi_type structure for the new array layout.
- See Also:
-
freeAggregate
final void freeAggregate(long handle) Frees a FFI struct, union or array handle allocated vianewStruct(long[], boolean)
ornewArray(long, int)
.- Parameters:
handle
- The FFI struct handle
-
invokeI0
static int invokeI0(long callContext, long function) Invokes a function with no arguments, and returns a 32 bit integer.- Parameters:
callContext
- The address of the call context structure fromnewCallContext(long, long[], int)
.function
- The address of the function to invoke.- Returns:
- A 32 bit integer value.
-
invokeI0NoErrno
static int invokeI0NoErrno(long callContext, long function) Invokes a function with no arguments, and returns a 32 bit integer. This method does not save the errno value.- Parameters:
callContext
- The address of the call context structure fromnewCallContext(long, long[], int)
.function
- The address of the function to invoke.- Returns:
- A 32 bit integer value.
-
invokeI1
static int invokeI1(long callContext, long function, int arg1) Invokes a function with one integer argument, and returns a 32 bit integer.- Parameters:
callContext
- The address of the call context structure fromnewCallContext(long, long[], int)
.function
- The address of the function to invoke.arg1
- The 32 bit integer argument.- Returns:
- A 32 bit integer value.
-
invokeI1NoErrno
static int invokeI1NoErrno(long callContext, long function, int arg1) Invokes a function with one integer argument, and returns a 32 bit integer. This method does not save the errno value.- Parameters:
callContext
- The address of the call context structure fromnewCallContext(long, long[], int)
.function
- The address of the function to invoke.arg1
- The 32 bit integer argument.- Returns:
- A 32 bit integer value.
-
invokeI2
static int invokeI2(long callContext, long function, int arg1, int arg2) Invokes a function with two integer arguments, and returns a 32 bit integer.- Parameters:
callContext
- The address of the call context structure fromnewCallContext(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.- Returns:
- A 32 bit integer value.
-
invokeI2NoErrno
static int invokeI2NoErrno(long callContext, long function, int arg1, int arg2) Invokes a function with two integer arguments, and returns a 32 bit integer. This method does not save the errno value.- Parameters:
callContext
- The address of the call context structure fromnewCallContext(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.- Returns:
- A 32 bit integer value.
-
invokeI3
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.- Parameters:
callContext
- The address of the call context structure fromnewCallContext(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.- Returns:
- A 32 bit integer value.
-
invokeI4
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.- Parameters:
callContext
- The address of the call context structure fromnewCallContext(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.- Returns:
- A 32 bit integer value.
-
invokeI5
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.- Parameters:
callContext
- The address of the call context structure fromnewCallContext(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.- Returns:
- A 32 bit integer value.
-
invokeI6
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.- Parameters:
callContext
- The address of the call context structure fromnewCallContext(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.- Returns:
- A 32 bit integer value.
-
invokeI3NoErrno
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. This method does not save the errno value.- Parameters:
callContext
- The address of the call context structure fromnewCallContext(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.- Returns:
- A 32 bit integer value.
-
invokeI4NoErrno
static int invokeI4NoErrno(long callContext, long function, int arg1, int arg2, int arg3, int arg4) -
invokeI5NoErrno
static int invokeI5NoErrno(long callContext, long function, int arg1, int arg2, int arg3, int arg4, int arg5) -
invokeI6NoErrno
static int invokeI6NoErrno(long callContext, long function, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6) -
invokeL0
static long invokeL0(long ctx, long function) Invokes a function with no arguments, and returns a 64 bit integer.- Parameters:
function
- The address of the function context structure fromnewCallContext(long, long[], int)
.- Returns:
- A 64 bit integer value.
-
invokeL1
static long invokeL1(long ctx, long function, long arg1) Invokes a function with one 64 bit integer argument, and returns a 64 bit integer.- Parameters:
function
- The address of the function context structure fromnewCallContext(long, long[], int)
.arg1
- The 64 bit integer argument.- Returns:
- A 64 bit integer value.
-
invokeL2
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.- Parameters:
function
- The address of the function context structure fromnewCallContext(long, long[], int)
.arg1
- The first 64 bit integer argument.arg2
- The second 64 bit integer argument.- Returns:
- A 64 bit integer value.
-
invokeL3
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.- Parameters:
function
- The address of the function context structure fromnewCallContext(long, long[], int)
.arg1
- The first 64 bit integer argument.arg2
- The second 64 bit integer argument.arg3
- The third 64 bit integer argument.- Returns:
- A 64 bit integer value.
-
invokeL4
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.- Parameters:
function
- The address of the function context structure fromnewCallContext(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.- Returns:
- A 64 bit integer value.
-
invokeL5
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.- Parameters:
function
- The address of the function context structure fromnewCallContext(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.- Returns:
- A 64 bit integer value.
-
invokeL6
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.- Parameters:
function
- The address of the function context structure fromnewCallContext(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.- Returns:
- A 64 bit integer value.
-
invokeL0NoErrno
static long invokeL0NoErrno(long ctx, long function) -
invokeL1NoErrno
static long invokeL1NoErrno(long ctx, long function, long arg1) -
invokeL2NoErrno
static long invokeL2NoErrno(long ctx, long function, long arg1, long arg2) -
invokeL3NoErrno
static long invokeL3NoErrno(long ctx, long function, long arg1, long arg2, long arg3) -
invokeL4NoErrno
static long invokeL4NoErrno(long ctx, long function, long arg1, long arg2, long arg3, long arg4) -
invokeL5NoErrno
static long invokeL5NoErrno(long ctx, long function, long arg1, long arg2, long arg3, long arg4, long arg5) -
invokeL6NoErrno
static long invokeL6NoErrno(long ctx, long function, long arg1, long arg2, long arg3, long arg4, long arg5, long arg6) -
invokeN0
static long invokeN0(long ctx, long function) Invokes a function with zero numeric arguments, and returns a numeric value.- Parameters:
function
- The address of the function context structure fromnewCallContext(long, long[], int)
.- Returns:
- A numeric value.
-
invokeN1
static long invokeN1(long ctx, long function, long arg1) Invokes a function with one numeric arguments, and returns a numeric value.- Parameters:
function
- The address of the function context structure fromnewCallContext(long, long[], int)
.arg1
- The first numeric argument.- Returns:
- A numeric value.
-
invokeN2
static long invokeN2(long ctx, long function, long arg1, long arg2) Invokes a function with two numeric arguments, and returns a numeric value.- Parameters:
function
- The address of the function context structure fromnewCallContext(long, long[], int)
.arg1
- The first numeric argument.arg2
- The second numeric argument.- Returns:
- A numeric value.
-
invokeN3
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.- Parameters:
function
- The address of the function context structure fromnewCallContext(long, long[], int)
.arg1
- The first numeric argument.arg2
- The second numeric argument.arg3
- The third numeric argument.- Returns:
- A numeric value.
-
invokeN4
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.- Parameters:
function
- The address of the function context structure fromnewCallContext(long, long[], int)
.arg1
- The first numeric argument.arg2
- The second numeric argument.arg3
- The third numeric argument.arg4
- The fourth numeric argument.- Returns:
- A numeric value.
-
invokeN5
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.- Parameters:
function
- The address of the function context structure fromnewCallContext(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.- Returns:
- A numeric value.
-
invokeN6
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.- Parameters:
function
- The address of the function context structure fromnewCallContext(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.- Returns:
- A numeric value.
-
invokeN1O1
static long invokeN1O1(long callContext, long functionAddress, long n1, Object o1, int o1flags, int o1off, int o1len) Invokes a function with one numeric argument, and returns a numeric value.- Parameters:
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.
-
invokeN2O1
static long invokeN2O1(long callContext, long functionAddress, long n1, long n2, Object o1, int o1flags, int o1off, int o1len) Invokes a function with two numeric arguments, and returns a numeric value.- Parameters:
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.- Returns:
- A numeric value.
-
invokeN2O2
static long invokeN2O2(long callContext, long functionAddress, long n1, long n2, Object o1, int o1flags, int o1off, int o1len, Object o2, int o2flags, int o2off, int o2len) Invokes a function with two numeric arguments, and returns a numeric value.- Parameters:
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.o2
- An Object (array or buffer), to be passed as a pointer.o2flags
- Object flags (direction, type, idx).o2off
- The offset from the start of the array or buffer.o2len
- The length of the array to use.- Returns:
- A numeric value.
-
invokeN3O1
static long invokeN3O1(long callContext, long functionAddress, long n1, long n2, long n3, Object o1, int o1flags, int o1off, int o1len) Invokes a function with three numeric arguments, and returns a numeric value.- Parameters:
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.o1flags
- Object flags (direction, type, parameter index).o1off
- The offset from the start of the array or buffer.o1len
- The length of the array to use.- Returns:
- A numeric value.
-
invokeN3O2
-
invokeN3O3
-
invokeN4O1
static long invokeN4O1(long callContext, long functionAddress, long n1, long n2, long n3, long n4, Object o1, int o1flags, int o1off, int o1len) -
invokeN4O2
-
invokeN4O3
-
invokeN4O4
-
invokeN5O1
static long invokeN5O1(long callContext, long functionAddress, long n1, long n2, long n3, long n4, long n5, Object o1, int o1flags, int o1off, int o1len) -
invokeN5O2
-
invokeN5O3
-
invokeN5O4
-
invokeN5O5
static long invokeN5O5(long callContext, long functionAddress, long n1, long n2, long n3, long n4, long n5, Object o1, int o1flags, int o1off, int o1len, Object o2, int o2flags, int o2off, int o2len, Object o3, int o3flags, int o3off, int o3len, Object o4, int o4flags, int o4off, int o4len, Object o5, int o5flags, int o5off, int o5len) -
invokeN6O1
static long invokeN6O1(long callContext, long functionAddress, long n1, long n2, long n3, long n4, long n5, long n6, Object o1, int o1flags, int o1off, int o1len) -
invokeN6O2
-
invokeN6O3
-
invokeN6O4
static long invokeN6O4(long callContext, long functionAddress, long n1, long n2, long n3, long n4, long n5, long n6, Object o1, int o1flags, int o1off, int o1len, Object o2, int o2flags, int o2off, int o2len, Object o3, int o3flags, int o3off, int o3len, Object o4, int o4flags, int o4off, int o4len) -
invokeN6O5
static long invokeN6O5(long callContext, long functionAddress, long n1, long n2, long n3, long n4, long n5, long n6, Object o1, int o1flags, int o1off, int o1len, Object o2, int o2flags, int o2off, int o2len, Object o3, int o3flags, int o3off, int o3len, Object o4, int o4flags, int o4off, int o4len, Object o5, int o5flags, int o5off, int o5len) -
invokeN6O6
static long invokeN6O6(long callContext, long functionAddress, long n1, long n2, long n3, long n4, long n5, long n6, Object o1, int o1flags, int o1off, int o1len, Object o2, int o2flags, int o2off, int o2len, Object o3, int o3flags, int o3off, int o3len, Object o4, int o4flags, int o4off, int o4len, Object o5, int o5flags, int o5off, int o5len, Object o6, int o6flags, int o6off, int o6len) -
invokeArrayReturnInt
static int invokeArrayReturnInt(long callContext, long function, byte[] buffer) Invokes a function that returns a 32 bit integer.- Parameters:
callContext
- The address of the call context structure fromnewCallContext(long, long[], int)
.buffer
- A byte array containing the arguments to the function.- Returns:
- A 32 bit integer value.
-
invokeArrayReturnLong
static long invokeArrayReturnLong(long callContext, long function, byte[] buffer) Invokes a function that returns a 64 bit integer.- Parameters:
callContext
- The address of the call context structure fromnewCallContext(long, long[], int)
.function
- The address of the function to invoke.buffer
- A byte array containing the arguments to the function.- Returns:
- A 64 bit integer value.
-
invokeArrayReturnFloat
static float invokeArrayReturnFloat(long callContext, long function, byte[] buffer) Invokes a function that returns a 32 bit floating point value.- Parameters:
callContext
- The address of the call context structure fromnewCallContext(long, long[], int)
.function
- The address of the function to invoke.buffer
- A byte array containing the arguments to the function.- Returns:
- A 32 bit floating point value.
-
invokeArrayReturnDouble
static double invokeArrayReturnDouble(long callContext, long function, byte[] buffer) Invokes a function that returns a 64 bit floating point value.- Parameters:
callContext
- The address of the call context structure fromnewCallContext(long, long[], int)
.function
- The address of the function to invoke.buffer
- A byte array containing the arguments to the function.- Returns:
- A 64 bit floating point value.
-
invokeArrayReturnStruct
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.- Parameters:
callContext
- The address of the call context structure fromnewCallContext(long, long[], int)
.function
- The address of the function to invoke.paramBuffer
- A byte array containing the arguments to the function.
-
invokeArrayWithObjectsReturnObject
static Object invokeArrayWithObjectsReturnObject(long callContext, long function, byte[] paramBuffer, int objectCount, int[] objectInfo, Object[] objects) Invokes a function that returns a java object. This is only useful when calling JNI functions directly.- Parameters:
callContext
- The address of the call context structure fromnewCallContext(long, long[], int)
.function
- The address of the function to invoke.paramBuffer
- A byte array containing the arguments to the function.
-
invokeArrayWithObjectsInt32
static int invokeArrayWithObjectsInt32(long callContext, long function, byte[] buffer, int objectCount, int[] objectInfo, Object[] objects) -
invokeArrayWithObjectsInt64
static long invokeArrayWithObjectsInt64(long callContext, long function, byte[] buffer, int objectCount, int[] objectInfo, Object[] objects) -
invokeArrayWithObjectsFloat
static float invokeArrayWithObjectsFloat(long callContext, long function, byte[] buffer, int objectCount, int[] objectInfo, Object[] objects) -
invokeArrayWithObjectsDouble
static double invokeArrayWithObjectsDouble(long callContext, long function, byte[] buffer, int objectCount, int[] objectInfo, Object[] objects) -
invokeArrayWithObjectsReturnStruct
static void invokeArrayWithObjectsReturnStruct(long callContext, long function, byte[] buffer, int objectCount, int[] objectInfo, Object[] objects, byte[] returnBuffer, int returnBufferOffset) -
invokeArrayO1Int32
static int invokeArrayO1Int32(long callContext, long function, byte[] buffer, Object o1, int o1Info, int o1off, int o1len) -
invokeArrayO2Int32
-
invokeArrayO1Int64
static long invokeArrayO1Int64(long callContext, long function, byte[] buffer, Object o1, int o1Info, int o1off, int o1len) -
invokeArrayO2Int64
-
invokePointerParameterArray
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.- Parameters:
functionContext
- The address of the function context structure fromnewCallContext(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.
-
getByte
static byte getByte(long address) Reads an 8 bit integer from a native memory location.- Parameters:
address
- The memory location to get the value from.- Returns:
- A byte containing the value.
-
getShort
static short getShort(long address) Reads a 16 bit integer from a native memory location.- Parameters:
address
- The memory location to get the value from.- Returns:
- A short containing the value.
-
getInt
static int getInt(long address) Reads a 32 bit integer from a native memory location.- Parameters:
address
- The memory location to get the value from.- Returns:
- An int containing the value.
-
getLong
static long getLong(long address) Reads a 64 bit integer from a native memory location.- Parameters:
address
- The memory location to get the value from.- Returns:
- A long containing the value.
-
getFloat
static float getFloat(long address) Reads a 32 bit floating point value from a native memory location.- Parameters:
address
- The memory location to get the value from.- Returns:
- A float containing the value.
-
getDouble
static double getDouble(long address) Reads a 64 bit floating point value from a native memory location.- Parameters:
address
- The memory location to get the value from.- Returns:
- A double containing the value.
-
getAddress
static long getAddress(long address) Reads a native memory address from a native memory location.- Parameters:
address
- The memory location to get the value from.- Returns:
- A long containing the value.
-
putByte
static void putByte(long address, byte value) Writes an 8 bit integer value to a native memory location.- Parameters:
address
- The memory location to put the value.value
- The value to write to memory.
-
putShort
static void putShort(long address, short value) Writes a 16 bit integer value to a native memory location.- Parameters:
address
- The memory location to put the value.value
- The value to write to memory.
-
putInt
static void putInt(long address, int value) Writes a 32 bit integer value to a native memory location.- Parameters:
address
- The memory location to put the value.value
- The value to write to memory.
-
putLong
static void putLong(long address, long value) Writes a 64 bit integer value to a native memory location.- Parameters:
address
- The memory location to put the value.value
- The value to write to memory.
-
putFloat
static void putFloat(long address, float value) Writes a 32 bit floating point value to a native memory location.- Parameters:
address
- The memory location to put the value.value
- The value to write to memory.
-
putDouble
static void putDouble(long address, double value) Writes a 64 bit floating point value to a native memory location.- Parameters:
address
- The memory location to put the value.value
- The value to write to memory.
-
putAddress
static void putAddress(long address, long value) Writes a native memory address value to a native memory location.- Parameters:
address
- The memory location to put the value.value
- The value to write to memory.
-
setMemory
static void setMemory(long address, long size, byte value) Sets a region of native memory to a specific byte value.- Parameters:
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.
-
copyMemory
static void copyMemory(long src, long dst, long size) Copies contents of a native memory location to another native memory location.- Parameters:
src
- The source memory address.dst
- The destination memory address.size
- The number of bytes to copy.
-
putByteArray
static void putByteArray(long address, byte[] data, int offset, int length) Writes a java byte array to native memory.- Parameters:
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.
-
getByteArray
static void getByteArray(long address, byte[] data, int offset, int length) Reads a java byte array from native memory.- Parameters:
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.
-
putCharArray
static void putCharArray(long address, char[] data, int offset, int length) Writes a java char array to native memory.- Parameters:
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.
-
getCharArray
static void getCharArray(long address, char[] data, int offset, int length) Reads a java char array from native memory.- Parameters:
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.
-
putShortArray
static void putShortArray(long address, short[] data, int offset, int length) Writes a java short array to native memory.- Parameters:
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.
-
getShortArray
static void getShortArray(long address, short[] data, int offset, int length) Reads a java short array from native memory.- Parameters:
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.
-
putIntArray
static void putIntArray(long address, int[] data, int offset, int length) Writes a java int array to native memory.- Parameters:
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.
-
getIntArray
static void getIntArray(long address, int[] data, int offset, int length) Reads a java int array from native memory.- Parameters:
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.
-
putLongArray
static void putLongArray(long address, long[] data, int offset, int length) Writes a java long array to native memory.- Parameters:
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.
-
getLongArray
static void getLongArray(long address, long[] data, int offset, int length) Reads a java long array from native memory.- Parameters:
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.
-
putFloatArray
static void putFloatArray(long address, float[] data, int offset, int length) Writes a java double array to native memory.- Parameters:
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.
-
getFloatArray
static void getFloatArray(long address, float[] data, int offset, int length) Reads a java float array from native memory.- Parameters:
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.
-
putDoubleArray
static void putDoubleArray(long address, double[] data, int offset, int length) Writes a java double array to native memory.- Parameters:
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.
-
getDoubleArray
static void getDoubleArray(long address, double[] data, int offset, int length) Reads a java double array from native memory.- Parameters:
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.
-
memchr
static long memchr(long address, int value, long len) Gets the address of a byte value in a native memory region.- Parameters:
address
- The native memory address to start searching.value
- The value to search for.len
- The size of the native memory region being searched.- Returns:
- The address of the value, or 0 (zero) if not found.
-
memmove
static void memmove(long dst, long src, long len) Copies potentially overlapping memory areas.- Parameters:
dst
- The destination memory address.src
- The source memory address.len
- The number of bytes to copy.
-
memcpy
static void memcpy(long dst, long src, long len) Copies non-overlapping memory areas.- Parameters:
dst
- The destination memory address.src
- The source memory address.len
- The number of bytes to copy.
-
strlen
static long strlen(long address) Gets the length of a native ascii or utf-8 string.- Parameters:
address
- The native address of the string.- Returns:
- The length of the string, in bytes.
-
getZeroTerminatedByteArray
static byte[] getZeroTerminatedByteArray(long address) Copies a zero (nul) terminated by array from native memory. This method will search for a zero byte, starting fromaddress
and stop once a zero byte is encountered. The returned byte array does not contain the terminating zero byte.- Parameters:
address
- The address to copy the array from- Returns:
- A byte array containing the bytes copied from native memory.
-
getZeroTerminatedByteArray
static byte[] getZeroTerminatedByteArray(long address, int maxlen) Copies a zero (nul) terminated by array from native memory. This method will search for a zero byte, starting fromaddress
and stop once a zero byte is encountered. The returned byte array does not contain the terminating zero byte.- Parameters:
address
- The address to copy the array frommaxlen
- The maximum number of bytes to search for the nul terminator- Returns:
- A byte array containing the bytes copied from native memory.
-
putZeroTerminatedByteArray
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. Note A total of length + 1 bytes is written to native memory.- Parameters:
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 memory
-
getByteChecked
static byte getByteChecked(long address) Reads an 8 bit integer from a native memory location.- Parameters:
address
- The memory location to get the value from.- Returns:
- A byte containing the value.
-
getShortChecked
static short getShortChecked(long address) Reads a 16 bit integer from a native memory location.- Parameters:
address
- The memory location to get the value from.- Returns:
- A short containing the value.
-
getIntChecked
static int getIntChecked(long address) Reads a 32 bit integer from a native memory location.- Parameters:
address
- The memory location to get the value from.- Returns:
- An int containing the value.
-
getLongChecked
static long getLongChecked(long address) Reads a 64 bit integer from a native memory location.- Parameters:
address
- The memory location to get the value from.- Returns:
- A long containing the value.
-
getFloatChecked
static float getFloatChecked(long address) Reads a 32 bit floating point value from a native memory location.- Parameters:
address
- The memory location to get the value from.- Returns:
- A float containing the value.
-
getDoubleChecked
static double getDoubleChecked(long address) Reads a 64 bit floating point value from a native memory location.- Parameters:
address
- The memory location to get the value from.- Returns:
- A double containing the value.
-
getAddressChecked
static long getAddressChecked(long address) Reads a native memory address from a native memory location.- Parameters:
address
- The memory location to get the value from.- Returns:
- A long containing the value.
-
putByteChecked
static void putByteChecked(long address, byte value) Writes an 8 bit integer value to a native memory location.- Parameters:
address
- The memory location to put the value.value
- The value to write to memory.
-
putShortChecked
static void putShortChecked(long address, short value) Writes a 16 bit integer value to a native memory location.- Parameters:
address
- The memory location to put the value.value
- The value to write to memory.
-
putIntChecked
static void putIntChecked(long address, int value) Writes a 32 bit integer value to a native memory location.- Parameters:
address
- The memory location to put the value.value
- The value to write to memory.
-
putLongChecked
static void putLongChecked(long address, long value) Writes a 64 bit integer value to a native memory location.- Parameters:
address
- The memory location to put the value.value
- The value to write to memory.
-
putFloatChecked
static void putFloatChecked(long address, float value) Writes a 32 bit floating point value to a native memory location.- Parameters:
address
- The memory location to put the value.value
- The value to write to memory.
-
putDoubleChecked
static void putDoubleChecked(long address, double value) Writes a 64 bit floating point value to a native memory location.- Parameters:
address
- The memory location to put the value.value
- The value to write to memory.
-
putAddressChecked
static void putAddressChecked(long address, long value) Writes a native memory address value to a native memory location.- Parameters:
address
- The memory location to put the value.value
- The value to write to memory.
-
setMemoryChecked
static void setMemoryChecked(long address, long size, byte value) Sets a region of native memory to a specific byte value.- Parameters:
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.
-
copyMemoryChecked
static void copyMemoryChecked(long src, long dst, long size) Copies contents of a native memory location to another native memory location.- Parameters:
src
- The source memory address.dst
- The destination memory address.size
- The number of bytes to copy.
-
putByteArrayChecked
static void putByteArrayChecked(long address, byte[] data, int offset, int length) Writes a java byte array to native memory.- Parameters:
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.
-
getByteArrayChecked
static void getByteArrayChecked(long address, byte[] data, int offset, int length) Reads a java byte array from native memory.- Parameters:
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.
-
putCharArrayChecked
static void putCharArrayChecked(long address, char[] data, int offset, int length) Writes a java char array to native memory.- Parameters:
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.
-
getCharArrayChecked
static void getCharArrayChecked(long address, char[] data, int offset, int length) Reads a java char array from native memory.- Parameters:
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.
-
putShortArrayChecked
static void putShortArrayChecked(long address, short[] data, int offset, int length) Writes a java short array to native memory.- Parameters:
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.
-
getShortArrayChecked
static void getShortArrayChecked(long address, short[] data, int offset, int length) Reads a java short array from native memory.- Parameters:
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.
-
putIntArrayChecked
static void putIntArrayChecked(long address, int[] data, int offset, int length) Writes a java int array to native memory.- Parameters:
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.
-
getIntArrayChecked
static void getIntArrayChecked(long address, int[] data, int offset, int length) Reads a java int array from native memory.- Parameters:
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.
-
putLongArrayChecked
static void putLongArrayChecked(long address, long[] data, int offset, int length) Writes a java long array to native memory.- Parameters:
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.
-
getLongArrayChecked
static void getLongArrayChecked(long address, long[] data, int offset, int length) Reads a java long array from native memory.- Parameters:
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.
-
putFloatArrayChecked
static void putFloatArrayChecked(long address, float[] data, int offset, int length) Writes a java double array to native memory.- Parameters:
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.
-
getFloatArrayChecked
static void getFloatArrayChecked(long address, float[] data, int offset, int length) Reads a java float array from native memory.- Parameters:
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.
-
putDoubleArrayChecked
static void putDoubleArrayChecked(long address, double[] data, int offset, int length) Writes a java double array to native memory.- Parameters:
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.
-
getDoubleArrayChecked
static void getDoubleArrayChecked(long address, double[] data, int offset, int length) Reads a java double array from native memory.- Parameters:
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.
-
memchrChecked
static long memchrChecked(long address, int value, long len) Gets the address of a byte value in a native memory region.- Parameters:
address
- The native memory address to start searching.value
- The value to search for.len
- The size of the native memory region being searched.- Returns:
- The address of the value, or 0 (zero) if not found.
-
memmoveChecked
static void memmoveChecked(long dst, long src, long len) Copies potentially overlapping memory areas.- Parameters:
dst
- The destination memory address.src
- The source memory address.len
- The number of bytes to copy.
-
memcpyChecked
static void memcpyChecked(long dst, long src, long len) Copies non-overlapping memory areas.- Parameters:
dst
- The destination memory address.src
- The source memory address.len
- The number of bytes to copy.
-
strlenChecked
static long strlenChecked(long address) Gets the length of a native ascii or utf-8 string.- Parameters:
address
- The native address of the string.- Returns:
- The length of the string, in bytes.
-
getZeroTerminatedByteArrayChecked
static byte[] getZeroTerminatedByteArrayChecked(long address) Copies a zero Checked(nul) terminated by array from native memory. This method will search for a zero byte, starting fromaddress
and stop once a zero byte is encountered. The returned byte array does not contain the terminating zero byte.- Parameters:
address
- The address to copy the array from- Returns:
- A byte array containing the bytes copied from native memory.
-
getZeroTerminatedByteArrayChecked
static byte[] getZeroTerminatedByteArrayChecked(long address, int maxlen) Copies a zero Checked(nul) terminated by array from native memory. This method will search for a zero byte, starting fromaddress
and stop once a zero byte is encountered. The returned byte array does not contain the terminating zero byte.- Parameters:
address
- The address to copy the array frommaxlen
- The maximum number of bytes to search for the nul terminator- Returns:
- A byte array containing the bytes copied from native memory.
-
putZeroTerminatedByteArrayChecked
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. Note A total of length + 1 bytes is written to native memory.- Parameters:
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 memory
-
newDirectByteBuffer
Creates a new Direct ByteBuffer for a native memory region.- Parameters:
address
- The start of the native memory region.capacity
- The size of the native memory region.- Returns:
- A ByteBuffer representing the native memory region.
-
getDirectBufferAddress
Gets the native memory address of a direct ByteBuffer- Parameters:
buffer
- A direct ByteBuffer to get the address of.- Returns:
- The native memory address of the buffer contents, or null if not a direct buffer.
-
longDoubleFromDouble
final void longDoubleFromDouble(double doubleValue, byte[] buf, int off, int len) -
longDoubleToDouble
final double longDoubleToDouble(byte[] buf, int off, int len) -
longDoubleFromString
-
longDoubleToString
-
longDoubleToEngineeringString
-
longDoubleToPlainString
-
newNativeMethod
-
freeNativeMethod
final void freeNativeMethod(long handle) -
compileNativeMethods
final long compileNativeMethods(long[] methods) -
freeCompiledMethods
final void freeCompiledMethods(long handle) -
registerNativeMethods
- Parameters:
clazz
- The java class to register the native methods onhandle
- The handle returned from compileNativeMethods- Returns:
- true if successful
-
unregisterNativeMethods
-
getSaveErrnoFunction
final long getSaveErrnoFunction() -
setCallContextErrorFunction
final void setCallContextErrorFunction(long ctx, long fn) -
getSaveErrnoCtxFunction
final long getSaveErrnoCtxFunction() -
getJNIVersion
final int getJNIVersion() -
getJavaVM
final long getJavaVM() -
fatalError
-
defineClass
-
defineClass
-
allocObject
-
registerNatives
-
unregisterNatives
-
getArch
-