1. 程式人生 > >JNI語法 JNI參考 JNI函式大全

JNI語法 JNI參考 JNI函式大全


96、AndroidJNI.NewObjectArray 新建物件陣列
static function NewObjectArray (size : int, clazz : IntPtr, obj : IntPtr) : IntPtr
Description描述
Constructs a new array holding objects in class clazz. All elements are initially set to obj.
構造新的陣列,它將儲存在類 clazz 中的物件。所有元素初始值均設為 obj。

97、AndroidJNI.NewObject 新建物件
static function NewObject (clazz : IntPtr, methodID : IntPtr, args : jvalue[]) : IntPtr
Description描述
Constructs a new Java object. The method ID indicates which constructor method to invoke. This ID must be obtained by calling GetMethodID() with as the method name and void (V) as the return type.
構造新的 Java 物件。方法 ID指示應呼叫的建構函式方法。該 ID 必須通過呼叫 GetMethodID() 獲得,且呼叫時的方法名必須為 ,而返回型別必須為 void (V)。
clazz 引數務必不要引用陣列類。

98、AndroidJNI.NewShortArray 新建短整數陣列

static function NewShortArray (size : int) : IntPtr
Description描述
Construct a new primitive array object.
構造一個新的基本陣列物件。

99、AndroidJNI.NewStringUTF 新建UTF字串
static function NewStringUTF (bytes : string) : IntPtr
Description描述
Constructs a new java.lang.String object from an array of characters in modified UTF-8 encoding.
利用 UTF-8 字元陣列構造新的 java.lang.String 物件。

100、AndroidJNI.PopLocalFrame 彈出區域性幀

static function PopLocalFrame (result : IntPtr) : IntPtr
Description描述
Pops off the current local reference frame, frees all the local references, and returns a local reference in the previous local reference frame for the given result object.
彈出關閉當前區域性引用幀,釋放所有的本地引用,並返回一個區域性引用,在前一個區域性引用幀,用於給定的結果物件。
    PushLocalFrame為一定數量的區域性引用建立了一個使用堆疊,而PopLocalFrame負責銷燬堆疊頂端的引用。
    Push/PopLocalFrame函式對提供了對區域性引用的生命週期更方便的管理。
    在管理區域性引用的生命週期中,Push/PopLocalFrame是非常方便的。你可以在本地函式的入口處呼叫PushLocalFrame,然後在出口處呼叫PopLocalFrame,這樣的話,在函式對中間任何位置建立的區域性引用都會被釋放。而且,這兩個函式是非常高效的。
    如果你在函式的入口處呼叫了PushLocalFrame,記住在所有的出口(有return出現的地方)呼叫PopLocalFrame。
    大量的區域性引用建立會浪費不必要的記憶體。一個區域性引用會導致它本身和它所指向的物件都得不到回收。尤其要注意那些長時間執行的方法、建立區域性引用的迴圈和工具函式,充分得利用Pus/PopLocalFrame來高效地管理區域性引用。

101、AndroidJNI.PushLocalFrame 壓入區域性幀

static function PushLocalFrame (capacity : int) : int
Description描述
Creates a new local reference frame, in which at least a given number of local references can be created.
建立一個新的區域性引入幀,至少一個給定的區域性引用可以被建立的數。
    PushLocalFrame為一定數量的區域性引用建立了一個使用堆疊,而PopLocalFrame負責銷燬堆疊頂端的引用。
    Push/PopLocalFrame函式對提供了對區域性引用的生命週期更方便的管理。
    在管理區域性引用的生命週期中,Push/PopLocalFrame是非常方便的。你可以在本地函式的入口處呼叫PushLocalFrame,然後在出口處呼叫PopLocalFrame,這樣的話,在函式對中間任何位置建立的區域性引用都會被釋放。而且,這兩個函式是非常高效的。
    如果你在函式的入口處呼叫了PushLocalFrame,記住在所有的出口(有return出現的地方)呼叫PopLocalFrame。
    大量的區域性引用建立會浪費不必要的記憶體。一個區域性引用會導致它本身和它所指向的物件都得不到回收。尤其要注意那些長時間執行的方法、建立區域性引用的迴圈和工具函式,充分得利用Pus/PopLocalFrame來高效地管理區域性引用。

102、AndroidJNI.SetBooleanArrayElement 設定布林陣列陣列元素
static function SetBooleanArrayElement (array : IntPtr, index : int, val : byte) : void
Description描述
Sets the value of one element in a primitive array.
設定一個基本陣列一個元素的值。
This function is a special case of SetBooleanArrayRegion(), called with region size set to 1.
這個函式是一個特殊情況的SetBooleanArrayRegion(),就是region大小設定為1時。

103、AndroidJNI.SetBooleanField 設定布林域
static function SetBooleanField (obj : IntPtr, fieldID : IntPtr, val : bool) : void
Description描述
This function sets the value of an instance (nonstatic) field of an object.
這個函式設定一個物件例項(非靜態)域的值。

104、AndroidJNI.SetByteArrayElement 設定位元組陣列元素
static function SetByteArrayElement (array : IntPtr, index : int, val : sbyte) : void
Description描述
Sets the value of one element in a primitive array.
設定一個基本陣列一個元素的值。
This function is a special case of SetByteArrayRegion(), called with region size set to 1.
這個函式是一個特殊情況的SetByteArrayRegion(),就是region大小設定為1時。

106、AndroidJNI.SetByteField 設定位元組域
static function SetByteField (obj : IntPtr, fieldID : IntPtr, val : Byte) : void
Description描述
This function sets the value of an instance (nonstatic) field of an object.
這個函式設定一個物件例項(非靜態)域的值。

107、AndroidJNI.SetCharArrayElement 設定字元陣列元素
static function SetCharArrayElement (array : IntPtr, index : int, val : Char) : void
Description描述
Sets the value of one element in a primitive array.
設定一個基本陣列一個元素的值。
This function is a special case of SetCharArrayRegion(), called with region size set to 1.
這個函式是一個特殊情況的SetCharArrayRegion(),就是region大小設定為1時。

108、AndroidJNI.SetCharField 設定字元域
static function SetCharField (obj : IntPtr, fieldID : IntPtr, val : Char) : void
Description描述
This function sets the value of an instance (nonstatic) field of an object.
這個函式設定一個物件例項(非靜態)域的值。

109、AndroidJNI.SetDoubleArrayElement 設定雙精度浮點數陣列元素
static function SetDoubleArrayElement (array : IntPtr, index : int, val : double) : void
Description描述
Sets the value of one element in a primitive array.
設定一個基本陣列一個元素的值。
This function is a special case of SetDoubleArrayRegion(), called with region size set to 1.
這個函式是一個特殊情況的SetDoubleArrayRegion(),就是region大小設定為1時。

110、AndroidJNI.SetDoubleField 設定雙精度浮點數域
static function SetDoubleField (obj : IntPtr, fieldID : IntPtr, val : double) : void
Description描述
This function sets the value of an instance (nonstatic) field of an object.
這個函式設定一個物件例項(非靜態)域的值。

111、AndroidJNI.SetFloatArrayElement 設定浮點數陣列元素
static function SetFloatArrayElement (array : IntPtr, index : int, val : float) : void
Description描述
Sets the value of one element in a primitive array.
設定一個基本陣列一個元素的值。
This function is a special case of SetFloatArrayRegion(), called with region size set to 1.
這個函式是一個特殊情況的SetFloatArrayRegion(),就是region大小設定為1時。

112、AndroidJNI.SetFloatField 設定浮點數域
static function SetFloatField (obj : IntPtr, fieldID : IntPtr, val : float) : void
Description描述
This function sets the value of an instance (nonstatic) field of an object.
這個函式設定一個物件例項(非靜態)域的值。

113、AndroidJNI.SetIntArrayElement 設定整數陣列元素
static function SetIntArrayElement (array : IntPtr, index : int, val : Int32) : void
Description描述
Sets the value of one element in a primitive array.
設定一個基本陣列一個元素的值。
This function is a special case of SetIntArrayRegion(), called with region size set to 1.
這個函式是一個特殊情況的SetIntArrayRegion(),就是region大小設定為1時。

114、AndroidJNI.SetIntField 設定整數域
static function SetIntField (obj : IntPtr, fieldID : IntPtr, val : Int32) : void
Description描述
This function sets the value of an instance (nonstatic) field of an object.
這個函式設定一個物件例項(非靜態)域的值。

115、AndroidJNI.SetLongArrayElement 設定長整數陣列元素
static function SetLongArrayElement (array : IntPtr, index : int, val : Int64) : void
Description描述
Sets the value of one element in a primitive array.
設定一個基本陣列一個元素的值。
This function is a special case of SetLongArrayRegion(), called with region size set to 1.
這個函式是一個特殊情況的SetLongArrayRegion(),就是region大小設定為1時。

116、AndroidJNI.SetLongField 設定長整數域
static function SetLongField (obj : IntPtr, fieldID : IntPtr, val : Int64) : void
Description描述
This function sets the value of an instance (nonstatic) field of an object.
這個函式設定一個物件例項(非靜態)域的值。

117、AndroidJNI.SetObjectArrayElement 設定物件陣列元素
static function SetObjectArrayElement (array : IntPtr, index : int, obj : IntPtr) : void
Description描述
Sets an element of an Object array.
設定一個物件陣列的一個元素。

118、AndroidJNI.SetObjectField 設定物件域
static function SetObjectField (obj : IntPtr, fieldID : IntPtr, val : IntPtr) : void
Description描述
This function sets the value of an instance (nonstatic) field of an object.
這個函式設定一個物件例項(非靜態)域的值。
The value to set is a reference to either a java.lang.Object, or a subclass thereof.
要設定的值無論是一個java.lang.Object的引用,或者其子類。

119、AndroidJNI.SetShortArrayElement 設定短整數陣列元素
static function SetShortArrayElement (array : IntPtr, index : int, val : Int16) : void
Description描述
Sets the value of one element in a primitive array.
設定一個基本陣列一個元素的值。
This function is a special case of SetShortArrayRegion(), called with region size set to 1.
這個函式是一個特殊情況的SetShortArrayRegion(),就是region大小設定為1時。

120、AndroidJNI.SetShortField 設定短整數域
static function SetShortField (obj : IntPtr, fieldID : IntPtr, val : Int16) : void
Description描述
This function sets the value of an instance (nonstatic) field of an object.
這個函式設定一個物件例項(非靜態)域的值。

121、AndroidJNI.SetStaticBooleanField 設定靜態布林域
static function SetStaticBooleanField (clazz : IntPtr, fieldID : IntPtr, val : bool) : void
Description描述
This function ets the value of a static field of an object.
這個函式設定一個物件的靜態域的值。

122、AndroidJNI.SetStaticByteField 設定靜態位元組域
static function SetStaticByteField (clazz : IntPtr, fieldID : IntPtr, val : Byte) : void
Description描述
This function ets the value of a static field of an object.
這個函式設定一個物件的靜態域的值。

123、AndroidJNI.SetStaticCharField 設定靜態字元域
static function SetStaticCharField (clazz : IntPtr, fieldID : IntPtr, val : Char) : void
Description描述
This function ets the value of a static field of an object.
這個函式設定一個物件的靜態域的值。

124、AndroidJNI.SetStaticDoubleField 設定靜態雙精度浮點數域
static function SetStaticDoubleField (clazz : IntPtr, fieldID : IntPtr, val : double) : void
Description描述
This function ets the value of a static field of an object.
這個函式設定一個物件的靜態域的值。

125、AndroidJNI.SetStaticFloatField 設定靜態浮點數域
static function SetStaticFloatField (clazz : IntPtr, fieldID : IntPtr, val : float) : void
Description描述
This function ets the value of a static field of an object.
這個函式設定一個物件的靜態域的值。

126、AndroidJNI.SetStaticIntField 設定靜態整數域
static function SetStaticIntField (clazz : IntPtr, fieldID : IntPtr, val : Int32) : void
Description描述
This function ets the value of a static field of an object.
這個函式設定一個物件的靜態域的值。

127、AndroidJNI.SetStaticLongField 設定靜態長整數域
static function SetStaticLongField (clazz : IntPtr, fieldID : IntPtr, val : Int64) : void
Description描述
This function ets the value of a static field of an object.
這個函式設定一個物件的靜態域的值。

128、AndroidJNI.SetStaticObjectField 設定靜態物件域
static function SetStaticObjectField (clazz : IntPtr, fieldID : IntPtr, val : IntPtr) : void
Description描述
This function ets the value of a static field of an object.
這個函式設定一個物件的靜態域的值。
The value to set is a reference to either a java.lang.Object, or a subclass thereof.
設定該值不管是一個java.lang.Object的引用,或是其子類。

129、AndroidJNI.SetStaticShortField 設定靜態短整數域
static function SetStaticShortField (clazz : IntPtr, fieldID : IntPtr, val : Int16) : void
Description描述
This function ets the value of a static field of an object.
這個函式設定一個物件的靜態域的值。

130、AndroidJNI.SetStaticStringField 設定靜態字串域
static function SetStaticStringField (clazz : IntPtr, fieldID : IntPtr, val : string) : void
Description描述
This function ets the value of a static field of an object.
這個函式設定一個物件的靜態域的值。
This is a convenience function that calls SetStaticObjectField() with the same parameters, but performs the necessary marshalling of the string value.
這是一個方便的函式,呼叫帶有相同引數的SetStaticObjectField(),但執行需要字串的值編組。

131、AndroidJNI.SetStringField 設定字串域
static function SetStringField (obj : IntPtr, fieldID : IntPtr, val : string) : void
Description描述
This function sets the value of an instance (nonstatic) field of an object.
這個函式設定一個物件例項(非靜態)域的值。
This is a convenience function that calls SetObjectField() with the same parameters, but performs the necessary marshalling of the string value.
這是一個方便的函式,呼叫帶有相同引數的SetObjectField(),但執行字串的值需要編組。

132、AndroidJNI.ThrowNew 新的丟擲
static function ThrowNew (clazz : IntPtr, message : string) : int
Description描述
Constructs an exception object from the specified class with the message specified by message and causes that exception to be thrown.
利用指定類的訊息(由 message 指定)構造異常物件並丟擲該異常。

133、AndroidJNI.Throw 丟擲
static function Throw (obj : IntPtr) : int
Description描述
Causes a java.lang.Throwable object to be thrown.