Wednesday, April 24, 2013

jni jnienv ReleaseStringUTFChars example c c++ java


ReleaseStringUTFChars


void ReleaseStringUTFChars(JNIEnv *env, jstring string,
const char *utf);

Informs the VM that the native code no longer needs access to utf. The utf argument is a pointer derived from string usingGetStringUTFChars().
LINKAGE:
Index 170 in the JNIEnv interface function table.
PARAMETERS of ReleaseStringUTFChars

env: the JNI interface pointer.

string: a Java string object.

utf: a pointer to a modified UTF-8 string.

Example of ReleaseStringUTFChars


const char* utf_string;
jboolean isCopy;
utf_string = env->GetStringUTFChars(str, &isCopy);
/* ... use string ... */
if (isCopy == JNI_TRUE) {
    env->ReleaseStringUTFChars(str, utf_string);
}

Example of ReleaseStringUTFChars