Java_jni Field Descriptor "([ljava/lang/string;) V" (Android)

Source: Internet
Author: User

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)

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.