![]() ![]() ![]() ![]() |
Contents |
Congratulations! You have learned a great deal about the JNI. To help you remember everything you have learned, this section summarizes the JNI functions and mapping types.Mapping Between JNI and Native Types
The following two tables summarize how Java types map to native types and the rules for encoding Java types in native signatures.
Primitive Types and Native Equivalents
Java Type Native Type Size in bits boolean
jboolean
8, unsigned byte
jbyte
8 char
jchar
16, unsigned short
jshort
16 int
jint
32 long
jlong
64 float
jfloat
32 double
jdouble
64 void
void
n/a
Signature | Java Programming Language Type |
Z | boolean |
B | byte |
C | char |
S | short |
I | int |
J | long |
F | float |
D | double |
L fully-qualified-class ; | fully-qualified-class |
[ type | type[] |
( arg-types ) ret-type | method type |
GetStringChars
- GetStringLength
- GetStringUTFChars
- GetStringUTFLength
- NewString
- NewStringUTF
- ReleaseStringChars
ReleaseStringUTFChars
GetArrayLength
- Get<type>ArrayElements
- GetBooleanArrayElements
- GetByteArrayElements
- GetCharArrayElements
- GetDoubleArrayElements
- GetFloatArrayElements
- GetIntArrayElements
- GetLongArrayElements
- GetShortArrayElements
- Release<type>ArrayElements
- Get<type>ArrayRegion
- Set<type>ArrayRegion
- GetObjectArrayElement
SetObjectArrayElement
GetObjectClass
- GetMethodID
- GetStaticMethodID
- Call<returntype>Method
- CallBooleanMethod
- CallByteMethod
- CallCharMethod
- CallDoubleMethod
- CallFloatMethod
- CallIntMethod
- CallLongMethod
- CallObjectMethod
- CallShortMethod
- CallVoidMethod
- CallStatic<returntype>Method
- CallNonvirtual<returntype>Method
- Call<returntype>MethodV
Call<returntype>MethodA
GetFieldID
- GetStaticFieldID
- Get<type>Field
- GetBooleanField
- GetByteField
- GetCharField
- GetDoubleField
- GetFloatField
- GetIntField
- GetLongField
- GetObjectField
- GetShortField
- Set<type>Field
- GetStatic<type>Field
SetStatic<type>Field
ExceptionClear
- ExceptionDescribe
ExceptionOccurred
NewGlobalRef
- DeleteGlobalRef
DeleteLocalRef
MonitorEnter
MonitorExit
![]() ![]() ![]() ![]() |
Contents |