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

Source: Internet
Author: User
"([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 int[], it needs to be represented as such "[I". If multiple arrays double[][][] is required to be represented as such "[[[D]. In other words, each square bracket begins, representing an array dimension. After multiple boxes, is the type of the array.

A descriptor that starts with an L is a class descriptor, followed by the string of the class, and then the semicolon ";" ends.

Like "ljava/lang/string;" is the presentation type string;

"[I" means int[];

"[Ljava/lang/object;" is to express object[].

The Jni method descriptor, which places the argument in parentheses, places the return type behind the parentheses, as follows:

(parameter descriptor) return type

When a function does not need to return a parameter type, it is represented using "V".

For example "() ljava/lang/string;" is to represent 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

Voi D

V

Objects Object

start with "L" with ";" At the end, the middle is a "/"   separated package and class name. For example: ljava/lang/string; if it is a nested class, then the $ is used to represent nesting. For example   "(ljava/lang/string; landroid/os/fileutils$filestatus;) Z "

Another shorthand for an array type is represented by "[" plus a shorthand for the corresponding type as shown in Table A.

For example: [I represents int [];[ L/java/lang/objects means objects[], in addition. The label of a reference type (other than an array of basic types) has a last ";"

For example:

"() V" means void Func ();

"(II) V" means void Func (int, int);

"(ljava/lang/string; ljava/lang/string) I ". Represents int Func (string,string)

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.