Functions
JNFCallBooleanMethod
Calls a method of a Java object that returns a boolean.
+jboolean JNFCallBooleanMethod(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *method,
+ ...
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- method
The member information for the method.
- ...
The parameters to pass to the method.
Return Value
The result of the method.
JNFCallByteMethod
Calls a method of a Java object that returns a byte.
+jbyte JNFCallByteMethod(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *method,
+ ...
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- method
The member information for the method.
- ...
The parameters to pass to the method.
Return Value
The result of the method.
JNFCallCharMethod
Calls a method of a Java object that returns a char.
+jchar JNFCallCharMethod(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *method,
+ ...
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- method
The member information for the method.
- ...
The parameters to pass to the method.
Return Value
The result of the method.
JNFCallDoubleMethod
Calls a method of a Java object that returns a double.
+jdouble JNFCallDoubleMethod(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *method,
+ ...
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- method
The member information for the method.
- ...
The parameters to pass to the method.
Return Value
The result of the method.
JNFCallFloatMethod
Calls a method of a Java object that returns a float.
+jfloat JNFCallFloatMethod(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *method,
+ ...
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- method
The member information for the method.
- ...
The parameters to pass to the method.
Return Value
The result of the method.
JNFCallIntMethod
Calls a method of a Java object that returns an int.
+jint JNFCallIntMethod(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *method,
+ ...
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- method
The member information for the method.
- ...
The parameters to pass to the method.
Return Value
The result of the method.
JNFCallLongMethod
Calls a method of a Java object that returns a long.
+jlong JNFCallLongMethod(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *method,
+ ...
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- method
The member information for the method.
- ...
The parameters to pass to the method.
Return Value
The result of the method.
JNFCallObjectMethod
Calls a method of a Java object that returns an object.
+jobject JNFCallObjectMethod(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *method,
+ ...
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- method
The member information for the method.
- ...
The parameters to pass to the method.
Return Value
The result of the method.
JNFCallShortMethod
Calls a method of a Java object that returns a short.
+jshort JNFCallShortMethod(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *method,
+ ...
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- method
The member information for the method.
- ...
The parameters to pass to the method.
Return Value
The result of the method.
JNFCallStaticBooleanMethod
Calls a static method of a Java object that returns a boolean.
+jboolean JNFCallStaticBooleanMethod(
+ JNIEnv *env,
+ JNFMemberInfo *method,
+ ...
+);
+
Parameters
- env
The JNI environment of the calling thread.
- method
The member information for the method.
- ...
The parameters to pass to the method.
Return Value
The result of the method.
JNFCallStaticByteMethod
Calls a static method of a Java object that returns a byte.
+jbyte JNFCallStaticByteMethod(
+ JNIEnv *env,
+ JNFMemberInfo *method,
+ ...
+);
+
Parameters
- env
The JNI environment of the calling thread.
- method
The member information for the method.
- ...
The parameters to pass to the method.
Return Value
The result of the method.
JNFCallStaticCharMethod
Calls a static method of a Java object that returns a char.
+jchar JNFCallStaticCharMethod(
+ JNIEnv *env,
+ JNFMemberInfo *method,
+ ...
+);
+
Parameters
- env
The JNI environment of the calling thread.
- method
The member information for the method.
- ...
The parameters to pass to the method.
Return Value
The result of the method.
JNFCallStaticDoubleMethod
Calls a static method of a Java object that returns a double.
+jdouble JNFCallStaticDoubleMethod(
+ JNIEnv *env,
+ JNFMemberInfo *method,
+ ...
+);
+
Parameters
- env
The JNI environment of the calling thread.
- method
The member information for the method.
- ...
The parameters to pass to the method.
Return Value
The result of the method.
JNFCallStaticFloatMethod
Calls a static method of a Java object that returns a float.
+jfloat JNFCallStaticFloatMethod(
+ JNIEnv *env,
+ JNFMemberInfo *method,
+ ...
+);
+
Parameters
- env
The JNI environment of the calling thread.
- method
The member information for the method.
- ...
The parameters to pass to the method.
Return Value
The result of the method.
JNFCallStaticIntMethod
Calls a static method of a Java object that returns an int.
+jint JNFCallStaticIntMethod(
+ JNIEnv *env,
+ JNFMemberInfo *method,
+ ...
+);
+
Parameters
- env
The JNI environment of the calling thread.
- method
The member information for the method.
- ...
The parameters to pass to the method.
Return Value
The result of the method.
JNFCallStaticLongMethod
Calls a static method of a Java object that returns a long.
+jlong JNFCallStaticLongMethod(
+ JNIEnv *env,
+ JNFMemberInfo *method,
+ ...
+);
+
Parameters
- env
The JNI environment of the calling thread.
- method
The member information for the method.
- ...
The parameters to pass to the method.
Return Value
The result of the method.
JNFCallStaticObjectMethod
Calls a static method of a Java object that returns an object.
+jobject JNFCallStaticObjectMethod(
+ JNIEnv *env,
+ JNFMemberInfo *method,
+ ...
+);
+
Parameters
- env
The JNI environment of the calling thread.
- method
The member information for the method.
- ...
The parameters to pass to the method.
Return Value
The result of the method.
JNFCallStaticShortMethod
Calls a static method of a Java object that returns a short.
+jshort JNFCallStaticShortMethod(
+ JNIEnv *env,
+ JNFMemberInfo *method,
+ ...
+);
+
Parameters
- env
The JNI environment of the calling thread.
- method
The member information for the method.
- ...
The parameters to pass to the method.
Return Value
The result of the method.
JNFCallStaticVoidMethod
Calls a static method of a Java object that returns void.
+void JNFCallStaticVoidMethod(
+ JNIEnv *env,
+ JNFMemberInfo *method,
+ ...
+);
+
Parameters
- env
The JNI environment of the calling thread.
- method
The member information for the method.
- ...
The parameters to pass to the method.
JNFCallVoidMethod
Calls a method of a Java object that returns void.
+void JNFCallVoidMethod(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *method,
+ ...
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- method
The member information for the method.
- ...
The parameters to pass to the method.
JNFDeleteGlobalRef
Deletes a global reference to a Java object.
+void JNFDeleteGlobalRef(
+ JNIEnv *env,
+ jobject globalRef
+);
+
Parameters
- env
The JNI environment.
- obj
The Java object.
JNFGetBooleanField
Gets a non-static boolean field of a Java object.
+jboolean JNFGetBooleanField(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *field
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- field
The member information for the boolean field.
Return Value
The boolean stored in field.
JNFGetByteField
Gets a non-static byte field of a Java object.
+jbyte JNFGetByteField(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *field
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- field
The member information for the byte field.
Return Value
The byte stored in field.
JNFGetCharField
Gets a non-static char field of a Java object.
+jchar JNFGetCharField(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *field
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- field
The member information for the char field.
Return Value
The char stored in field.
JNFGetDoubleField
Gets a non-static double field of a Java object.
+jdouble JNFGetDoubleField(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *field
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- field
The member information for the double field.
Return Value
The double stored in field.
JNFGetFloatField
Gets a non-static float field of a Java object.
+jfloat JNFGetFloatField(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *field
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- field
The member information for the float field.
Return Value
The float stored in field.
JNFGetIntField
Gets a non-static int field of a Java object.
+jint JNFGetIntField(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *field
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- field
The member information for the int field.
Return Value
The int stored in field.
JNFGetLongField
Gets a non-static long field of a Java object.
+jlong JNFGetLongField(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *field
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- field
The member information for the long field.
Return Value
The long stored in field.
JNFGetObjectField
Gets a non-static object field of a Java object.
+jobject JNFGetObjectField(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *field
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- field
The member information for the object field.
Return Value
The object stored in field.
JNFGetShortField
Gets a non-static short field of a Java object.
+jshort JNFGetShortField(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *field
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- field
The member information for the short field.
Return Value
The short stored in field.
JNFGetStaticBooleanField
Gets a static boolean field of a Java object.
+jboolean JNFGetStaticBooleanField(
+ JNIEnv *env,
+ JNFMemberInfo *field
+);
+
Parameters
- env
The JNI environment of the calling thread.
- field
The member information for the boolean field.
Return Value
The boolean stored in field.
JNFGetStaticByteField
Gets a static byte field of a Java object.
+jbyte JNFGetStaticByteField(
+ JNIEnv *env,
+ JNFMemberInfo *field
+);
+
Parameters
- env
The JNI environment of the calling thread.
- field
The member information for the byte field.
Return Value
The byte stored in field.
JNFGetStaticCharField
Gets a static char field of a Java object.
+jchar JNFGetStaticCharField(
+ JNIEnv *env,
+ JNFMemberInfo *field
+);
+
Parameters
- env
The JNI environment of the calling thread.
- field
The member information for the char field.
Return Value
The char stored in field.
JNFGetStaticDoubleField
Gets a static double field of a Java object.
+jdouble JNFGetStaticDoubleField(
+ JNIEnv *env,
+ JNFMemberInfo *field
+);
+
Parameters
- env
The JNI environment of the calling thread.
- field
The member information for the double field.
Return Value
The double stored in field.
JNFGetStaticFloatField
Gets a static float field of a Java object.
+jfloat JNFGetStaticFloatField(
+ JNIEnv *env,
+ JNFMemberInfo *field
+);
+
Parameters
- env
The JNI environment of the calling thread.
- field
The member information for the float field.
Return Value
The float stored in field.
JNFGetStaticIntField
Gets a static int field of a Java object.
+jint JNFGetStaticIntField(
+ JNIEnv *env,
+ JNFMemberInfo *field
+);
+
Parameters
- env
The JNI environment of the calling thread.
- field
The member information for the int field.
Return Value
The int stored in field.
JNFGetStaticLongField
Gets a static long field of a Java object.
+jlong JNFGetStaticLongField(
+ JNIEnv *env,
+ JNFMemberInfo *field
+);
+
Parameters
- env
The JNI environment of the calling thread.
- field
The member information for the long field.
Return Value
The long stored in field.
JNFGetStaticObjectField
Gets a static object field of a Java object.
+jobject JNFGetStaticObjectField(
+ JNIEnv *env,
+ JNFMemberInfo *field
+);
+
Parameters
- env
The JNI environment of the calling thread.
- field
The member information for the object field.
Return Value
The object stored in field.
JNFGetStaticShortField
Gets a static short field of a Java object.
+jshort JNFGetStaticShortField(
+ JNIEnv *env,
+ JNFMemberInfo *field
+);
+
Parameters
- env
The JNI environment of the calling thread.
- field
The member information for the short field.
Return Value
The short stored in field.
JNFGetStringUTF16UniChars
Gets UTF-16 characters from a jstring
object.
+const unichar *JNFGetStringUTF16UniChars(
+ JNIEnv *env,
+ jstring javaString
+);
+
Parameters
- env
The JNI environment of the calling thread.
- javaString
The jstring
object to convert.
Return Value
A UTF-16 character array representation of javaString.
Discussion
This function raises a JNFException if UTF-16 characters cannot be obtained.
You need to release the return value with JNFReleaseStringUTF16UniChars
.
Declared In
JNFGetStringUTF8Chars
Gets UTF-8 characters from a jstring
object.
+const char *JNFGetStringUTF8Chars(
+ JNIEnv *env,
+ jstring javaString
+);
+
Parameters
- env
The JNI environment of the calling thread.
- javaString
The jstring
object to convert.
Return Value
A UTF-8 character array representation of javaString.
Discussion
This function raises a JNFException if UTF-8 characters cannot be obtained.
You need to release the return value with JNFReleaseStringUTF8Chars
.
Declared In
JNFIsInstanceOf
Returns the result of applying the instanceof
operator to a given Java object with a given class.
+BOOL JNFIsInstanceOf(
+ JNIEnv *env,
+ jobject obj,
+ JNFClassInfo *clazz
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- clazz
The class to compare against.
Return Value
YES
if obj is an instance of clazz; otherwise, NO
.
Declared In
JNFJavaMillisToNSTimeInterval
Converts a millisecond time interval calculated from Java’s January 1, 1970 epoch to an NSTimeInterval
object calculated from the January 1, 2001 epoch of OS X.
+NSTimeInterval JNFJavaMillisToNSTimeInterval(
+ jlong javaMillisSince1970
+);
+
Parameters
- javaMillisSince1970
The Java interval to convert.
Return Value
An NSTimeInterval
representation of javaMillisSince1970
.
Declared In
JNFJavaToNSDate
Converts a java.util.Calendar
object or a java.util.Date
object to an NSDate
object.
+NSDate *JNFJavaToNSDate(
+ JNIEnv *env,
+ jobject date
+);
+
Parameters
- env
The JNI environment of the calling thread.
- date
The java.util.Calendar
object or java.util.Date
object to convert.
Return Value
An autoreleased NSDate
representation of date
.
Declared In
JNFJavaToNSNumber
Converts a java.lang.Number
object to an NSNumber
object.
+NSNumber *JNFJavaToNSNumber(
+ JNIEnv *env,
+ jobject n
+);
+
Parameters
- env
The JNI environment of the calling thread.
- n
The java.lang.Number
object.
Return Value
An autoreleased NSNumber
representation of n.
Declared In
JNFJavaToNSString
Converts a jstring
object to an NSString
object.
+NSString *JNFJavaToNSString(
+ JNIEnv *env,
+ jstring javaString
+);
+
Parameters
- env
The JNI environment of the calling thread.
- javaString
The jstring
object to convert.
Return Value
An autoreleased NSString
representation of javaString.
Declared In
JNFNewBooleanArray
Creates a Java boolean
array of a specified size.
+jbooleanArray JNFNewBooleanArray(
+ JNIEnv *env,
+ jsize length
+);
+
Parameters
- env
The JNI environment of the calling thread.
- length
The length of the array.
Return Value
The created array.
JNFNewByteArray
Creates a Java byte
array of a specified size.
+jbyteArray JNFNewByteArray(
+ JNIEnv *env,
+ jsize length
+);
+
Parameters
- env
The JNI environment of the calling thread.
- length
The length of the array.
Return Value
The created array.
JNFNewCharArray
Creates a Java char
array of a specified size.
+jcharArray JNFNewCharArray(
+ JNIEnv *env,
+ jsize length
+);
+
Parameters
- env
The JNI environment of the calling thread.
- length
The length of the array.
Return Value
The created array.
JNFNewDoubleArray
Creates a Java double
array of a specified size.
+jdoubleArray JNFNewDoubleArray(
+ JNIEnv *env,
+ jsize length
+);
+
Parameters
- env
The JNI environment of the calling thread.
- length
The length of the array.
Return Value
The created array.
JNFNewFloatArray
Creates a Java long
array of a specified size.
+jfloatArray JNFNewFloatArray(
+ JNIEnv *env,
+ jsize length
+);
+
Parameters
- env
The JNI environment of the calling thread.
- length
The length of the array.
Return Value
The created array.
JNFNewGlobalRef
Creates a global reference to a Java object.
+jobject JNFNewGlobalRef(
+ JNIEnv *env,
+ jobject obj
+);
+
Parameters
- env
The JNI environment.
- obj
The Java object.
Return Value
A new global reference to obj.
JNFNewIntArray
Creates a Java int
array of a specified size.
+jintArray JNFNewIntArray(
+ JNIEnv *env,
+ jsize length
+);
+
Parameters
- env
The JNI environment of the calling thread.
- length
The length of the array.
Return Value
The created array.
JNFNewLongArray
Creates a Java long
array of a specified size.
+jlongArray JNFNewLongArray(
+ JNIEnv *env,
+ jsize length
+);
+
Parameters
- env
The JNI environment of the calling thread.
- length
The length of the array.
Return Value
The created array.
JNFNewObject
Creates a new Java object of a given class with a given constructor.
+jobject JNFNewObject(
+ JNIEnv *env,
+ JNFMemberInfo *constructor,
+ ...
+);
+
Parameters
- env
The JNI environment of the calling thread.
- constructor
The member information for the constructor.
- ...
The parameters to pass to the constructor.
Return Value
The created Java object.
Declared In
JNFNewObjectArray
Creates an array of a specified size for instances of a specified Java class.
+jobjectArray JNFNewObjectArray(
+ JNIEnv *env,
+ JNFClassInfo *clazz,
+ jsize length
+);
+
Parameters
- env
The JNI environment of the calling thread.
- clazz
The class the array holds instances of.
- length
The length of the array.
Return Value
The created array.
JNFNewShortArray
Creates a Java short
array of a specified size.
+jshortArray JNFNewShortArray(
+ JNIEnv *env,
+ jsize length
+);
+
Parameters
- env
The JNI environment of the calling thread.
- length
The length of the array.
Return Value
The created array.
JNFNormalizedJavaStringForPath
Converts an NSString
object to a jstring
object suited for file system paths.
+jstring JNFNormalizedJavaStringForPath(
+ JNIEnv *env,
+ NSString *path
+);
+
Parameters
- env
The JNI environment of the calling thread.
- path
The NSString
object to convert.
Return Value
A jstring
representation of path in precomposed UTF-16 format.
Declared In
JNFNormalizedNSStringForPath
Converts a jstring
object to an NSString
object suited for file system paths.
+NSString *JNFNormalizedNSStringForPath(
+ JNIEnv *env,
+ jstring *path
+);
+
Parameters
- env
The JNI environment of the calling thread.
- path
The jstring
object to convert.
Return Value
An autoreleased NSString
representation of path in decomposed UTF-16 format.
Declared In
JNFNSTimeIntervalToJavaMillis
Converts an NSTimeInterval
object calculated from the January 1, 2001 epoch of OS X to a millisecond time interval calculated from Java’s January 1, 1970 epoch.
+jlong JNFNSTimeIntervalToJavaMillis(
+ NSTimeInterval intervalSince2001
+);
+
Parameters
- intervalSince2001
The NSTimeInterval
object to convert.
Return Value
A jlong
representation of intervalSince2001
.
Declared In
JNFNSToJavaCalendar
Converts an NSDate
object to a java.util.Calendar
object.
+jobject JNFNSToJavaCalendar(
+ JNIEnv *env,
+ NSDate *date
+);
+
Parameters
- env
The JNI environment of the calling thread.
- date
The NSDate
object to convert.
Return Value
A java.util.Calendar
representation of date
.
Declared In
JNFNSToJavaNumber
Converts an NSNumber
object to a java.lang.Number
object.
+jobject *JNFNSToJavaNumber(
+ JNIEnv *env,
+ NSNumber *n
+);
+
Parameters
- env
The JNI environment of the calling thread.
- n
The NSNumber
object.
Return Value
A java.lang.Long
representation of n if n is integral; otherwise, a java.lang.Double
representation of n.
Discussion
The return value is a JNI local reference. Code that calls this function must call DeleteLocalRef
with the return value.
Declared In
JNFNSToJavaString
Converts an NSString
object to a jstring
object.
+jstring JNFNSToJavaString(
+ JNIEnv *env,
+ NSString *nsString
+);
+
Parameters
- env
The JNI environment of the calling thread.
- nsString
The NSString
object to convert.
Return Value
A jstring
representation of nsString.
Discussion
The return value is a JNI local reference. Code that calls this function must call DeleteLocalRef
with the return value.
Declared In
JNFObjectClassName
Returns the result of calling Object.getClass().toString()
on a given Java object.
+NSString *JNFObjectClassName(
+ JNIEnv* env,
+ jobject obj,
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
Return Value
The result of obj.getClass().toString()
returned as an NSString
object.
Declared In
JNFObjectEquals
Returns the result of calling Object.equals()
with two given Java objects.
+BOOL JNFObjectEquals(
+ JNIEnv* env,
+ jobject a,
+ jobject b
+);
+
Parameters
- env
The JNI environment of the calling thread.
- a
The first Java object to compare.
- b
The second Java object to compare.
Return Value
YES
if a and b are equal according to a.equals(b)
; otherwise, NO
.
Declared In
JNFObjectToString
Returns the result of calling Object.toString()
on a given Java object.
+NSString *JNFObjectToString(
+ JNIEnv* env,
+ jobject obj,
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
Return Value
The result of obj.toString()
returned as an NSString
object.
Declared In
JNFObtainEnv
Attaches the current thread to the Java VM and obtains a JNI environment to interact with it.
+JNIEnv *JNFObtainEnv(
+ JNFThreadContext *context
+);
+
Parameters
- context
The current thread’s context.
Return Value
The JNI environment.
Discussion
You should use this function only when it is otherwise impossible to pass the JNI environment to the current context, such as in a callback.
JNFPerformEnvBlock
Sets up a JNI environment and executes a specified block in it.
+void JNFPerformEnvBlock(
+ JNFThreadContext context,
+ JNIEnvBlock block
+);
+
Parameters
- context
The current thread’s context.
- block
The block to execute.
Discussion
This function calls JNFObtainEnv
before executing block and calls JNFReleaseEnv
afterwards. Call this function when you otherwise do not have access to a JNI environment. The JNI environment created by this function is valid only for the duration of the execution of block.
JNFReleaseEnv
Releases this thread’s JNI environment and detaches the thread from the Java VM.
+void JNFReleaseEnv(
+ JNIEnv *env,
+ JNFThreadContext *context
+);
+
Parameters
- env
The JNI environment.
- context
The current thread’s context.
JNFReleaseStringUTF16UniChars
Releases UTF-16 characters obtained with JNFGetStringUTF16UniChars
.
+void JNFReleaseStringUTF16UniChars(
+ JNIEnv *env,
+ jstring javaString,
+ const unichar *unichars
+);
+
Parameters
- env
The JNI environment of the calling thread.
- javaString
The jstring
object that the characters were obtained from.
- unichars
The UTF-16 characters to release.
Declared In
JNFReleaseStringUTF8Chars
Releases UTF-8 characters obtained with JNFGetStringUTF8Chars
.
+void JNFReleaseStringUTF8Chars(
+ JNIEnv *env,
+ jstring javaString,
+ const char *chars
+);
+
Parameters
- env
The JNI environment of the calling thread.
- javaString
The jstring
object that the characters were obtained from.
- chars
The UTF-8 characters to release.
Declared In
JNFSetBooleanField
Sets a non-static boolean field of a Java object.
+void JNFSetBooleanField(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *field,
+ jboolean val
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- field
The member information for the object field.
- val
The new value of field.
JNFSetByteField
Sets a non-static byte field of a Java object.
+void JNFSetByteField(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *field,
+ jbyte val
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- field
The member information for the object field.
- val
The new value of field.
JNFSetCharField
Sets a non-static char field of a Java object.
+void JNFSetCharField(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *field,
+ jchar val
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- field
The member information for the object field.
- val
The new value of field.
JNFSetDoubleField
Sets a non-static double field of a Java object.
+void JNFSetDoubleField(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *field,
+ jdouble val
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- field
The member information for the object field.
- val
The new value of field.
JNFSetFloatField
Sets a non-static float field of a Java object.
+void JNFSetFloatField(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *field,
+ jfloat val
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- field
The member information for the object field.
- val
The new value of field.
JNFSetIntField
Sets a non-static int field of a Java object.
+void JNFSetIntField(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *field,
+ jint val
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- field
The member information for the object field.
- val
The new value of field.
JNFSetLongField
Sets a non-static long field of a Java object.
+void JNFSetLongField(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *field,
+ jlong val
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- field
The member information for the object field.
- val
The new value of field.
JNFSetObjectField
Sets a non-static object field of a Java object.
+void JNFSetObjectField(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *field,
+ jobject val
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- field
The member information for the object field.
- val
The new value of field.
JNFSetShortField
Sets a non-static short field of a Java object.
+void JNFSetShortField(
+ JNIEnv *env,
+ jobject obj,
+ JNFMemberInfo *field,
+ jshort val
+);
+
Parameters
- env
The JNI environment of the calling thread.
- obj
The Java object.
- field
The member information for the object field.
- val
The new value of field.
JNFSetStaticBooleanField
Sets a static boolean field of a Java object.
+void JNFSetStaticBooleanField(
+ JNIEnv *env,
+ JNFMemberInfo *field,
+ jboolean val
+);
+
Parameters
- env
The JNI environment of the calling thread.
- field
The member information for the object field.
- val
The new value of field.
JNFSetStaticByteField
Sets a static byte field of a Java object.
+void JNFSetStaticByteField(
+ JNIEnv *env,
+ JNFMemberInfo *field,
+ jbyte val
+);
+
Parameters
- env
The JNI environment of the calling thread.
- field
The member information for the object field.
- val
The new value of field.
JNFSetStaticCharField
Sets a static char field of a Java object.
+void JNFSetStaticCharField(
+ JNIEnv *env,
+ JNFMemberInfo *field,
+ jchar val
+);
+
Parameters
- env
The JNI environment of the calling thread.
- field
The member information for the object field.
- val
The new value of field.
JNFSetStaticDoubleField
Sets a static double field of a Java object.
+void JNFSetStaticDoubleField(
+ JNIEnv *env,
+ JNFMemberInfo *field,
+ jdouble val
+);
+
Parameters
- env
The JNI environment of the calling thread.
- field
The member information for the object field.
- val
The new value of field.
JNFSetStaticFloatField
Sets a static float field of a Java object.
+void JNFSetStaticFloatField(
+ JNIEnv *env,
+ JNFMemberInfo *field,
+ jfloat val
+);
+
Parameters
- env
The JNI environment of the calling thread.
- field
The member information for the object field.
- val
The new value of field.
JNFSetStaticIntField
Sets a static int field of a Java object.
+void JNFSetStaticIntField(
+ JNIEnv *env,
+ JNFMemberInfo *field,
+ jint val
+);
+
Parameters
- env
The JNI environment of the calling thread.
- field
The member information for the object field.
- val
The new value of field.
JNFSetStaticLongField
Sets a static long field of a Java object.
+void JNFSetStaticLongField(
+ JNIEnv *env,
+ JNFMemberInfo *field,
+ jlong val
+);
+
Parameters
- env
The JNI environment of the calling thread.
- field
The member information for the object field.
- val
The new value of field.
JNFSetStaticObjectField
Sets a static object field of a Java object.
+void JNFSetStaticObjectField(
+ JNIEnv *env,
+ JNFMemberInfo *field,
+ jobject val
+);
+
Parameters
- env
The JNI environment of the calling thread.
- field
The member information for the object field.
- val
The new value of field.
JNFSetStaticShortField
Sets a static short field of a Java object.
+void JNFSetStaticShortField(
+ JNIEnv *env,
+ JNFMemberInfo *field,
+ jshort val
+);
+
Parameters
- env
The JNI environment of the calling thread.
- field
The member information for the object field.
- val
The new value of field.
JNF_CLASS_CACHE
Creates a JNFClassInfo
struct with desired parameters.
+#define JNF_CLASS_CACHE(cache_symbol, name) \
+JNFClassInfo cache_symbol = {name, NULL}
+
Parameters
- cache_symbol
The variable name of the struct.
- name
The name of the class that the struct represents.
JNF_COCOA_ENTER
A macro that indicates the beginning of a JNI method.
+#define JNF_COCOA_ENTER(env) \
+{ \
+ JNFAutoreleasePoolToken* _token = JNFNativeMethodEnter(); \
+ JNF_COCOA_DURING(env)
+
Parameters
- env
The JNI environment of the calling thread.
Discussion
This macro sets up an autorelease pool for a JNI method and initiates a try block.
You should include this macro at the beginning of every JNI method.
JNF_COCOA_EXIT
A macro that indicates the end of a JNI method.
+#define JNF_COCOA_EXIT(env) \
+ JNF_COCOA_HANDLE(env) \
+ if (_token) JNFNativeMethodExit(_token); \
+}
+
Parameters
- env
The JNI environment of the calling thread.
Discussion
This macro cleans up the autorelease pool created by JNF_COCOA_ENTER
and throws any exceptions caught during the method to the Java VM.
You should include this macro at the end of every JNI method.
JNF_CTOR_CACHE
Creates a JNFMemberInfo
struct for a constructor method with desired parameters.
+#define JNF_CTOR_CACHE(cache_symbol, class_cache_symbol, sig) \
+JNFMemberInfo _ ## cache_symbol = {"<init>", sig, NO, &class_cache_symbol, {NULL}}, *cache_symbol=&_ ## cache_symbol
+
Parameters
- cache_symbol
The variable name of the struct.
- class_cache_symbol
The JNFClassInfo
struct that represents the class that this field or method is a member of.
- sig
The signature of the field or method.
JNF_MEMBER_CACHE
Creates a JNFMemberInfo
struct for a non-static field or method with desired parameters.
+#define JNF_MEMBER_CACHE(cache_symbol, class_cache_symbol, name, sig) \
+JNFMemberInfo _ ## cache_symbol = {name, sig, NO, &class_cache_symbol, {NULL}}, *cache_symbol=&_ ## cache_symbol
+
Parameters
- cache_symbol
The variable name of the struct.
- class_cache_symbol
The JNFClassInfo
struct that represents the class that this field or method is a member of.
- name
The name of the field or method.
- sig
The signature of the field or method.
JNF_STATIC_MEMBER_CACHE
Creates a JNFMemberInfo
struct for a static field or method with desired parameters.
+#define JNF_STATIC_MEMBER_CACHE(cache_symbol, class_cache_symbol, name, sig) \
+JNFMemberInfo _ ## cache_symbol = {name, sig, YES, &class_cache_symbol, {NULL}}, *cache_symbol=&_ ## cache_symbol
+
Parameters
- cache_symbol
The variable name of the struct.
- class_cache_symbol
The JNFClassInfo
struct that represents the class that this field or method is a member of.
- name
The name of the field or method.
- sig
The signature of the field or method.