jni Field Descriptor "([ljava/lang/string;) V
"([ljava/lang/string;) V" It is an encoding of function return values and parameters. This encoding is called the Jni field descriptor (javanative Interface fielddescriptors). 、
An array of int[], it needs to be expressed as such "[I".
If more than one array double[][][] is required to be represented as such "[[[D]. That is, each square bracket starts with an array of dimensions. After more than one box, it is the type of the array.
If a descriptor that begins with an L is a class descriptor , it is followed by the string of the class, and then the semicolon ";" ends.
such as "ljava/lang/string;" is the expression type string;
"[I" means int[];
"[Ljava/lang/object;] is the expression object[].
The Jni method descriptor is mainly to place the parameters in parentheses, followed by the return type after the parentheses, as follows:
(parameter descriptor) return type
When a function does not need to return a parameter type, it is represented by "V".
such as "() ljava/lang/string;" is the expression string f ();
"(Iljava/lang/class;) J" means long f (int i, Class c);
"([B) V" means void String (byte[] bytes);
Java type |
Symbol |
Boolean |
Z |
Byte |
B |
Char |
C |
Short |
S |
Int |
I |
Long |
J |
Float |
F |
Double |
D |
Void |
V |
Objects Object |
Start with "L", with ";" End, the middle is a "/" separated by the package and the class name. For example: ljava/lang/string; if it is a nested class, use $ to represent nesting. For example "(ljava/lang/string; landroid/os/fileutils$filestatus;) Z " |
In addition, the shorthand for the array type is expressed as "[" plus the shorthand form of the corresponding type shown in Table A.
Like what:
[I means int [];
[l/java/lang/objects; means objects[],
Other than that. A reference type (other than an array of primitive types) is marked with a ";" at the end.
For example:
"() V" means void Func ();
"(II) V" denotes void Func (int, int);
"(ljava/lang/string; ljava/lang/string;) I ". Represents int Func (string,string)
"
Java_jni Field Descriptor "([ljava/lang/string;) V" (Android)