Android-Jni Environment Function

Source: Internet
Author: User

Typedef const struct JNINativeInterface * JNIEnv;


Const struct JNINativeInterface... = {


NULL,
NULL,
NULL,
NULL,
GetVersion, // get the JNI version


DefineClass, // load the class by specifying the ClassLoader object
FindClass, // get the specified Class Object


FromReflectedMethod, // obtain the Method ID through the specified java. lang. reflect. Method object
FromReflectedField, // obtain the Field ID through the specified java. lang. reflect. Field object
ToReflectedMethod, // obtain the java. lang. reflect. Method object through the specified Method ID


GetSuperclass, // get the parent class of the specified class
IsAssignableFrom, // determines whether the specified class inherits from a certain class or implements an Interface


ToReflectedField, // obtain the java. lang. reflect. Field object through the specified Field ID


Throw, // Throw the specified Throwable object
ThrowNew, // throw the specified Throwable object and specify the message
ExceptionOccurred, // gets an uncleared or captured exception
ExceptionDescribe, // same as printStackTrace ()
ExceptionClear, // clear thrown exceptions
FatalError, // throw a fatal error


PushLocalFrame, // Push/PopLocalFrame function provides a simple method for local reference management. In the code segment between the function pairs, all created explicit local references do not need to be manually called to release the DeleteLocalReference function, the PopLocalFrame function automatically releases these local references.
PopLocalFrame,


NewGlobalRef, // create a global reference, which must be explicitly cleared
DeleteGlobalRef, // clear global reference
DeleteLocalRef, // clears local references. Generally, local references are automatically cleared when the native code returns. However, for big data, such as frequent creation of Java objects in a loop, this object is only valid in one loop. In this case, it is necessary to explicitly call DeleteLocalRef to notify the VM to release the object as soon as possible.
IsSameObject, // determines whether it is the same object. You can use this method to determine whether the weak reference has been released (NULL)
NewLocalRef, // create a local reference
EnsureLocalCapacity, // ensure that the current thread can create a specified number of local references


AllocObject, // create a new object, allocate only the memory, and do not call any Constructor (cdwang: it should be for the convenience of calling the constructor initialization object of the parent class through the CallNonvirtual <Type> Method)
NewObject, // create an object through the specified constructor, in the form of a variable-length parameter
NewObjectV, // same as above, in the form of va_list
NewObjectA, // same as above, array form


GetObjectClass, // get the Class Object of the object
IsInstanceOf, // same as instanceOf


GetMethodID, // get the ID of the Instance (non-static) Method


CallObjectMethod, // call the instance method. object indicates the type of the returned value.
CallObjectMethodV,
CallObjectMethodA,
CallBooleanMethod,
CallBooleanMethodV,
CallBooleanMethodA,
CallByteMethod,
CallByteMethodV,
CallByteMethodA,
CallCharMethod,
CallCharMethodV,
CallCharMethodA,
Callemedimethod,
Callemedimethodv,
Callemedimethoda,
CallIntMethod,
CallIntMethodV,
CallIntMethodA,
CallLongMethod,
CallLongMethodV,
CallLongMethodA,
CallFloatMethod,
CallFloatMethodV,
CallFloatMethodA,
CallDoubleMethod,
CallDoubleMethodV,
CallDoubleMethodA,
CallVoidMethod,
CallVoidMethodV,
CallVoidMethodA,


CallNonvirtualObjectMethod, // call the non-Virtual-real-name example method, and specify the class non-virtual function to be called through the class Object (cdwang: it should be the method implementation of an object that does not call its own constructor class, instead, it calls the method implementation of the parent class, which saves the forced conversion from the subclass object to the parent class object)
CallNonvirtualObjectMethodV,
CallNonvirtualObjectMethodA,
CallNonvirtualBooleanMethod,
CallNonvirtualBooleanMethodV,
CallNonvirtualBooleanMethodA,
CallNonvirtualByteMethod,
CallNonvirtualByteMethodV,
CallNonvirtualByteMethodA,
CallNonvirtualCharMethod,
CallNonvirtualCharMethodV,
CallNonvirtualCharMethodA,
Callnonvirtualinvoke method,
Callnonvirtual1_methodv,
Callnonvirtual1_methoda,
CallNonvirtualIntMethod,
CallNonvirtualIntMethodV,
CallNonvirtualIntMethodA,
CallNonvirtualLongMethod,
CallNonvirtualLongMethodV,
CallNonvirtualLongMethodA,
CallNonvirtualFloatMethod,
CallNonvirtualFloatMethodV,
CallNonvirtualFloatMethodA,
CallNonvirtualDoubleMethod,
CallNonvirtualDoubleMethodV,
CallNonvirtualDoubleMethodA,
CallNonvirtualVoidMethod,
CallNonvirtualVoidMethodV,
CallNonvirtualVoidMethodA,


GetFieldID, // get the member field ID


GetObjectField, // get the field value
GetBooleanField,
GetByteField,
GetCharField,
Getdomainfield,
GetIntField,
GetLongField,
GetFloatField,
GetDoubleField,
SetObjectField, // set the field value
SetBooleanField,
SetByteField,
SetCharField,
SetShortField,
SetIntField,
SetLongField,
SetFloatField,
SetDoubleField,


GetStaticMethodID, // obtain the static method ID


CallStaticObjectMethod, // call a static method
CallStaticObjectMethodV,
CallStaticObjectMethodA,
CallStaticBooleanMethod,
CallStaticBooleanMethodV,
CallStaticBooleanMethodA,
CallStaticByteMethod,
CallStaticByteMethodV,
CallStaticByteMethodA,
CallStaticCharMethod,
CallStaticCharMethodV,
CallStaticCharMethodA,
CallStaticShortMethod,
Callstatic1_methodv,
Callstatic1_methoda,
CallStaticIntMethod,
CallStaticIntMethodV,
CallStaticIntMethodA,
CallStaticLongMethod,
CallStaticLongMethodV,
CallStaticLongMethodA,
CallStaticFloatMethod,
CallStaticFloatMethodV,
CallStaticFloatMethodA,
CallStaticDoubleMethod,
CallStaticDoubleMethodV,
CallStaticDoubleMethodA,
CallStaticVoidMethod,
CallStaticVoidMethodV,
CallStaticVoidMethodA,


GetStaticFieldID, // obtain the static field ID


GetStaticObjectField, // obtain the field value
GetStaticBooleanField,
GetStaticByteField,
GetStaticCharField,
Getstatic1_field,
GetStaticIntField,
GetStaticLongField,
GetStaticFloatField,
GetStaticDoubleField,


SetStaticObjectField, // set the field value
SetStaticBooleanField,
SetStaticByteField,
SetStaticCharField,
Setstatic1_field,
SetStaticIntField,
SetStaticLongField,
SetStaticFloatField,
SetStaticDoubleField,


NewString, // construct a Java String by specifying an array of Unicode characters


GetStringLength, // get the length of Unicode characters
GetStringChars, // get the character array
ReleaseStringChars, // notifies VM to release String and character array obtained by GetStringChars
 
NewStringUTF, // construct a Java String by specifying an array of Characters in the UTF-8 format
GetStringUTFLength,
GetStringUTFChars,
ReleaseStringUTFChars,
 
GetArrayLength, // get the array length www.2cto.com
 
NewObjectArray, // initializes a Java object array through the specified Class object and initial element
GetObjectArrayElement, // get the object element of the specified index
SetObjectArrayElement, // sets the object element of the specified index
 
NewBooleanArray, // construct a Java array of the basic type
NewByteArray,
NewCharArray,
NewShortArray,
NewIntArray,
NewLongArray,
NewFloatArray,
NewDoubleArray,
 
GetBooleanArrayElements, // get the C array of the basic type element
GetByteArrayElements,
GetCharArrayElements,
GetShortArrayElements,
GetIntArrayElements,
GetLongArrayElements,
GetFloatArrayElements,
GetDoubleArrayElements,
 
ReleaseBooleanArrayElements, // notifies the VM to release the Java array and the C array obtained by the aforementioned method family.
ReleaseByteArrayElements,
ReleaseCharArrayElements,
ReleaseShortArrayElements,
ReleaseIntArrayElements,
ReleaseLongArrayElements,
ReleaseFloatArrayElements,
ReleaseDoubleArrayElements,
 
GetBooleanArrayRegion, // obtain the sub-array
GetByteArrayRegion,
GetCharArrayRegion,
GetShortArrayRegion,
GetIntArrayRegion,
GetLongArrayRegion,
GetFloatArrayRegion,
GetDoubleArrayRegion,
SetBooleanArrayRegion, // sets the sub-array
SetByteArrayRegion,
SetCharArrayRegion,
SetShortArrayRegion,
SetIntArrayRegion,
SetLongArrayRegion,
SetFloatArrayRegion,
SetDoubleArrayRegion,
 
RegisterNatives, // map native code
UnregisterNatives,
 
MonitorEnter,
MonitorExit,
 
GetJavaVM, // get the VM associated with the current thread


GetStringRegion, // get the substring
GetStringUTFRegion,


GetPrimitiveArrayCritical,
ReleasePrimitiveArrayCritical,


GetStringCritical, // Get/ReleaseStringCritical must appear in pairs. The semantics is the same as that of Get/ReleaseStringChars, but the code segment cannot block the current thread or call any other JNI functions.
ReleaseStringCritical,


NewWeakGlobalRef,
DeleteWeakGlobalRef,


ExceptionCheck, // determines whether an exception is pending.


NewDirectByteBuffer,
GetDirectBufferAddress,
GetDirectBufferCapacity
};


From rough roads

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.