Callback closure.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | |
| private static class | |
| private class | |
| private static class | CallbackReference.NativeFunctionHandler
Provide invocation handling for an auto-generated Java interface proxy for a native function pointer. |
| Modifier and Type | Field and Description |
|---|---|
| private static final Map | |
| pack-priv static final Map | |
| pack-priv static final Map | |
| pack-priv int | |
| pack-priv Pointer | |
| pack-priv Cleaner. | |
| pack-priv static final Map | |
| private static final Class | |
| private static final Map | |
| pack-priv Method | |
| pack-priv static final Map | |
| pack-priv CallbackProxy | |
| private static final Method | |
| pack-priv Pointer |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static Reference | |
| private static Method | |
| public void | |
| private static Callback | |
| protected void | |
| pack-priv static void | |
| pack-priv static Class | |
| public static Callback | |
| private static Callback | |
| private Callback | |
| private static Method | |
| private static Method | |
| public static Pointer | getFunctionPointer(Callback cb)
Return a |
| private static Pointer | |
| private static Pointer | getNativeFunctionPointer(Callback cb)
If the callback is one we generated to wrap a native function pointer, return that. |
| private static Pointer | |
| private Class | |
| public Pointer | |
| private static Callback | |
| private static ThreadGroup | |
| private static boolean | |
| private void | |
| pack-priv static CallbackThreadInitializer | Returns: The previous initializer instance (may benull)The cb, CallbackThreadInitializer Callback instanceThe initializer)CallbackThreadInitializer - if null then the
associated initializer instance is removed
|
| allocatedMemory | back to summary |
|---|---|
| private static final Map<Long, Reference<CallbackReference>> allocatedMemory | |
| allocations | back to summary |
|---|---|
| pack-priv static final Map<Object, Object> allocations | |
| callbackMap | back to summary |
|---|---|
| pack-priv static final Map<Callback, CallbackReference> callbackMap | |
| callingConvention | back to summary |
|---|---|
| pack-priv int callingConvention | |
| cbstruct | back to summary |
|---|---|
| pack-priv Pointer cbstruct | |
| cleanable | back to summary |
|---|---|
| pack-priv Cleaner. | |
| directCallbackMap | back to summary |
|---|---|
| pack-priv static final Map<Callback, CallbackReference> directCallbackMap | |
| DLL_CALLBACK_CLASS | back to summary |
|---|---|
| private static final Class<?> DLL_CALLBACK_CLASS | |
| initializers | back to summary |
|---|---|
| private static final Map<Callback, CallbackThreadInitializer> initializers | |
| method | back to summary |
|---|---|
| pack-priv Method method | |
| pointerCallbackMap | back to summary |
|---|---|
| pack-priv static final Map<Pointer, Reference<Callback>[]> pointerCallbackMap | |
| proxy | back to summary |
|---|---|
| pack-priv CallbackProxy proxy | |
| PROXY_CALLBACK_METHOD | back to summary |
|---|---|
| private static final Method PROXY_CALLBACK_METHOD | |
| trampoline | back to summary |
|---|---|
| pack-priv Pointer trampoline | |
| CallbackReference | back to summary |
|---|---|
| private CallbackReference(Callback callback, int callingConvention, boolean direct) | |
| addCallbackToArray | back to summary |
|---|---|
| private static Reference | |
| checkMethod | back to summary |
|---|---|
| private static Method checkMethod(Method m) | |
| close | back to summary |
|---|---|
| public void close() Implements java. Free native resources associated with this callback. | |
| createCallback | back to summary |
|---|---|
| private static Callback createCallback(Class<?> type, Pointer p) | |
| dispose | back to summary |
|---|---|
| protected void dispose()
Deprecated
| |
| disposeAll | back to summary |
|---|---|
| pack-priv static void disposeAll() Dispose of all memory allocated for callbacks. | |
| findCallbackClass | back to summary |
|---|---|
| pack-priv static Class | |
| getCallback | back to summary |
|---|---|
| public static Callback getCallback(Class<?> type, Pointer p) Return a Callback associated with the given function pointer. If the pointer refers to a Java callback trampoline, return the original Java Callback. Otherwise, return a proxy to the native function pointer.
| |
| getCallback | back to summary |
|---|---|
| private static Callback getCallback(Class<?> type, Pointer p, boolean direct) | |
| getCallback | back to summary |
|---|---|
| private Callback getCallback() | |
| getCallbackMethod | back to summary |
|---|---|
| private static Method getCallbackMethod(Callback callback) | |
| getCallbackMethod | back to summary |
|---|---|
| private static Method getCallbackMethod(Class<?> cls) | |
| getFunctionPointer | back to summary |
|---|---|
| public static Pointer getFunctionPointer(Callback cb) Return a | |
| getFunctionPointer | back to summary |
|---|---|
| private static Pointer getFunctionPointer(Callback cb, boolean direct) Native code may call this method with direct=true. | |
| getNativeFunctionPointer | back to summary |
|---|---|
| private static Pointer getNativeFunctionPointer(Callback cb) If the callback is one we generated to wrap a native function pointer, return that. Otherwise return null. | |
| getNativeString | back to summary |
|---|---|
| private static Pointer getNativeString(Object value, boolean wide) | |
| getNativeType | back to summary |
|---|---|
| private Class | |
| getTrampoline | back to summary |
|---|---|
| public Pointer getTrampoline() Obtain a pointer to the native glue code for this callback. | |
| getTypeAssignableCallback | back to summary |
|---|---|
| private static Callback getTypeAssignableCallback(Class<?> type, Reference<Callback>[] array) | |
| initializeThread | back to summary |
|---|---|
| private static ThreadGroup initializeThread(Callback cb, CallbackReference. | |
| isAllowableNativeType | back to summary |
|---|---|
| private static boolean isAllowableNativeType(Class<?> cls) Returns whether the given class is supported in native code. Other types (String, WString, Structure, arrays, NativeMapped, etc) are supported in the Java library. | |
| setCallbackOptions | back to summary |
|---|---|
| private void setCallbackOptions(int options) Set the behavioral options for this callback. | |
| setCallbackThreadInitializer | back to summary |
|---|---|
pack-priv static CallbackThreadInitializer setCallbackThreadInitializer(Callback cb, CallbackThreadInitializer initializer)
| |
| Modifier and Type | Field and Description |
|---|---|
| public boolean | |
| public boolean | |
| public static final List | |
| public String |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| protected List | getFieldOrder()
Overrides com. |
| daemon | back to summary |
|---|---|
| public boolean daemon | |
| detach | back to summary |
|---|---|
| public boolean detach | |
| FIELDS | back to summary |
|---|---|
| public static final List<String> FIELDS | |
| name | back to summary |
|---|---|
| public String name | |
| AttachOptions | back to summary |
|---|---|
| pack-priv AttachOptions() | |
| getFieldOrder | back to summary |
|---|---|
| protected List Overrides com. Doc from com. Returns this Structure's field names in their proper order.
Important Note When deriving from an existing Structure subclass, ensure that you augment the list provided by the superclass, e.g.
Field order must be explicitly indicated, since the
field order as returned by Class#getFields() is not
guaranteed to be predictable.
| |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized void |
| cbstruct | back to summary |
|---|---|
| private Pointer cbstruct | |
| CallbackReferenceDisposer | back to summary |
|---|---|
| public CallbackReferenceDisposer(Pointer cbstruct) | |
| run | back to summary |
|---|---|
| public synchronized void run() Implements java. Doc from java. Runs this operation. | |
| Modifier and Type | Field and Description |
|---|---|
| private final Method | |
| private final String | |
| private final FromNativeConverter[] | |
| private ToNativeConverter |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Object | |
| private Object | convertArgument(Object value, Class<?> dstType)
Convert argument from its basic native type to the given Java parameter type. |
| private Object | |
| public Callback | |
| public Class | getParameterTypes()
Implements com. |
| public Class | getReturnType()
Implements com. |
| private Object |
| callbackMethod | back to summary |
|---|---|
| private final Method callbackMethod | |
| encoding | back to summary |
|---|---|
| private final String encoding | |
| fromNative | back to summary |
|---|---|
| private final FromNativeConverter[] fromNative | |
| toNative | back to summary |
|---|---|
| private ToNativeConverter toNative | |
| DefaultCallbackProxy | back to summary |
|---|---|
| public DefaultCallbackProxy(Method callbackMethod, TypeMapper mapper, String encoding) | |
| callback | back to summary |
|---|---|
| public Object callback(Object[] args) Implements com. Called from native code. All arguments are in an array of Object as the first argument. Converts all arguments to types required by the actual callback method signature, and converts the result back into an appropriate native type. This method must not throw exceptions.
| |
| convertArgument | back to summary |
|---|---|
| private Object convertArgument(Object value, Class<?> dstType) Convert argument from its basic native type to the given Java parameter type. | |
| convertResult | back to summary |
|---|---|
| private Object convertResult(Object value) | |
| getCallback | back to summary |
|---|---|
| public Callback getCallback() | |
| getParameterTypes | back to summary |
|---|---|
| public Class Implements com. Doc from com. Returns the types of the parameters to the callback method.
| |
| getReturnType | back to summary |
|---|---|
| public Class Implements com. Doc from com. Returns the type of the callback method's return value.
| |
| invokeCallback | back to summary |
|---|---|
| private Object invokeCallback(Object[] args) | |
| Modifier and Type | Field and Description |
|---|---|
| private final Function | |
| private final Map |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Pointer | |
| public Object | invoke(Object
the proxy instance that the method was invoked on proxy, Method the method, Object[] Method instance corresponding to
the interface method invoked on the proxy instance. The declaring
class of the Method object will be the interface that
the method was declared in, which may be a superinterface of the
proxy interface that the proxy class inherits the method through.an array of objects containing the values of the
arguments passed in the method invocation on the proxy instance,
or args)null if interface method takes no arguments.
Arguments of primitive types are wrapped in instances of the
appropriate primitive wrapper class, such as
java.lang.Integer or java.lang.Boolean.Implements java. |
| function | back to summary |
|---|---|
| private final Function function | |
| options | back to summary |
|---|---|
| private final Map<String, ?> options | |
| NativeFunctionHandler | back to summary |
|---|---|
| public NativeFunctionHandler(Pointer address, int callingConvention, Map<String, ?> options) | |
| getPointer | back to summary |
|---|---|
| public Pointer getPointer() | |
| invoke | back to summary |
|---|---|
| public Object invoke(Object proxy, Method method, Object[] args) throws Throwable Implements java. Chain invocation to the native function.
| |