public class JNIMethodScope extends Object implements AutoCloseable
JNI.JNIEnv
value for the current thread within the native method call.
If the native method call returns a non-primitive value, the return value must be
set within the try-with-resources statement and then
retrieved and returned outside the try-with-resources statement.
This is necessary to support use of JNI local frames.| Constructor and Description |
|---|
JNIMethodScope(String scopeName,
JNI.JNIEnv env)
Enters the scope of an native method call.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
static JNI.JNIEnv |
env()
Gets the
JNI.JNIEnv value for the current thread. |
JNI.JNIEnv |
getEnv() |
<R extends JNI.JObject> |
getObjectResult() |
static JNIMethodScope |
scope()
Gets the inner most
JNIMethodScope value for the current thread. |
static JNIMethodScope |
scopeOrNull()
Gets the inner most
JNIMethodScope value for the current thread. |
void |
setObjectResult(JNI.JObject obj) |
String |
toString() |
public JNIMethodScope(String scopeName, JNI.JNIEnv env)
public static JNI.JNIEnv env()
JNI.JNIEnv value for the current thread.public JNI.JNIEnv getEnv()
public static JNIMethodScope scopeOrNull()
JNIMethodScope value for the current thread.public static JNIMethodScope scope()
JNIMethodScope value for the current thread.public void setObjectResult(JNI.JObject obj)
public <R extends JNI.JObject> R getObjectResult()
public void close()
close in interface AutoCloseable