JNI Types and Data Structures

 

Table 3-1 Primitive Types and Native Equivalents
Java Type
Native Type
Description
boolean
jboolean
unsigned 8 bits
byte
jbyte
signed 8 bits
char
jchar
unsigned 16 bits
short
jshort
signed 16 bits
int
jint
signed 32 bits
long
jlong
signed 64 bits
float
jfloat
32 bits
double
jdouble
64 bits
void
void
N/A

 

Type Signatures

The JNI uses the Java VM’s representation of type signatures. Table 3-2 shows these type signatures.
Table 3-2 Java VM Type Signatures
Type Signature
Java 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
For example, the Java method:
   long f (int n, String s, int[] arr); 
has the following type signature:
   (ILjava/lang/String;[I)J 
 
 
 

Comments

Popular posts from this blog

Bluetooth Data Transfer Example

DeCompile .apk file on ubuntu 14.04