public interface JVMNativeUtil extends NativeUtil
| Modifier and Type | Method and Description |
|---|---|
<T> T |
AllocObject(Class<T> clazz)
creates a instance of a object without calling a constructor.
|
Class<?> |
DefineClass(String name,
ClassLoader loader,
byte[] bytes,
int off,
int len)
Defines a class in the given classloader.
|
void |
DeleteGlobalRef(long ref)
Deletes a global ref.
|
NativeField |
FromReflectedField(Field field)
Gets a native reference to a java field from a given Reflection field.
|
<R> NativeMethod<R,R> |
FromReflectedMethod(Constructor<R> method)
reflection constructor to native method.
|
NativeMethod |
FromReflectedMethod(Method method)
reflection method to native method.
|
long |
GetDirectBufferAddress(ByteBuffer buffer)
returns the native address of a direct byte buffer.
|
NativeMemory |
GetDirectBufferAddress(ByteBuffer buffer,
int off,
int size)
Returns a NativeMemory object that uses the direct byte buffer object as backing.
|
<T,X> NativeField<T,X> |
GetFieldID(Class<T> clazz,
String fieldName,
String signature)
Gets a native reference to a java field.
|
<R,D> NativeMethod<R,D> |
GetMethodID(Class<D> declaring,
String name,
String signature)
Get non static native method by signature
|
<T,X> NativeField<T,X> |
GetStaticFieldID(Class<T> clazz,
String fieldName,
String signature)
Gets a native reference to a java field.
|
<R,D> NativeMethod<R,D> |
GetStaticMethodID(Class<D> declaring,
String name,
String signature)
Get static native method by signature
|
void |
MonitorEnter(Object obj)
Enter a monitor.
|
void |
MonitorExit(Object obj)
Exit from a monitor entered by MonitorEnter.
|
ByteBuffer |
NewDirectByteBuffer(long ptr,
long capacity)
returns a direct byte buffer using the given pointer and capacity.
|
long |
NewGlobalRef(Object obj)
returns a global reference that can be stored to a java object.
|
<T> T |
NewLocalRef(long ref)
Resolves a Global ref into a "object".
|
RuntimeException |
Throw(Throwable throwable)
This method allows throwing of checked exceptions in methods that do not declare them as checked exceptions.
|
isJVM, isLinux, isNoop, isWindowsClass<?> DefineClass(String name, ClassLoader loader, byte[] bytes, int off, int len) throws ClassFormatError, ClassCircularityError, SecurityException
name - MUST BE IN JNI NOTATION. for example "org.example.MyClass" would be "org/example/MyClass"ClassFormatError - if the bytes in buf are not a valid classClassCircularityError - if the class would be its own superclassSecurityException - if name starts with "java."void MonitorEnter(Object obj)
void MonitorExit(Object obj)
long GetDirectBufferAddress(ByteBuffer buffer)
ByteBuffer NewDirectByteBuffer(long ptr, long capacity)
NativeMemory GetDirectBufferAddress(ByteBuffer buffer, int off, int size)
<T> T AllocObject(Class<T> clazz)
long NewGlobalRef(Object obj)
NullPointerException - if obj is nullvoid DeleteGlobalRef(long ref)
<T> T NewLocalRef(long ref)
RuntimeException Throw(Throwable throwable)
NullPointerException - if the given throwable is nullThrowable - the given throwableNativeMethod FromReflectedMethod(Method method)
<R> NativeMethod<R,R> FromReflectedMethod(Constructor<R> method)
<R,D> NativeMethod<R,D> GetMethodID(Class<D> declaring, String name, String signature)
<R,D> NativeMethod<R,D> GetStaticMethodID(Class<D> declaring, String name, String signature)
NativeField FromReflectedField(Field field)
<T,X> NativeField<T,X> GetFieldID(Class<T> clazz, String fieldName, String signature)
clazz - the class the field is infieldName - the field namesignature - the signature of the field type<T,X> NativeField<T,X> GetStaticFieldID(Class<T> clazz, String fieldName, String signature)
clazz - the class the field is infieldName - the field namesignature - the signature of the field typeCopyright © 2023. All rights reserved.