Site Tools


Sidebar

Smart Card Solution

User Manual

JavaCard API Samples

Java Card Specification

Knowledge Sharing

javacard:jcvm:6.8.1_type_descriptor

6.8.1 type_descriptor

The type_descriptor structure represents the type of a field or the signature of a method.

The type_descriptor structure contains the following elements:

nibble_count

The nibble_count value represents the number of nibbles required to describe the type encoded in the type array.

type[]

The type array contains an encoded description of the type, composed of individual nibbles. If the nibble_count item is an odd number, the last nibble in the type array must be 0x0. The values of the type descriptor nibbles are defined in the following table.

Type

Value

void

0x1

boolean

0x2

byte

0x3

short

0x4

int

0x5

reference

0x6

array of boolean

0xA

array of byte

0xB

array of short

0xC

array of int

0xD

array of reference

0xE

Class reference types are described using the reference nibble 0x6, followed by a 2-byte (4-nibble) class_ref structure. The class_ref structure is defined as part of the CONSTANT_Classref_info structure ( Section 6.7.1, CONSTANT_Classref). For example, a field of type reference to p1.c1 in a CAP file defining package p0 is described as:

Nibble

Value

Description

0

0x6

reference

1

package token (high bit on)

2

3

class token

4

5

0x0

padding

The following are examples of the array types:

Nibble

Value

Description

0

0xB

array of byte

1

0x0

padding

Nibble

Value

Description

0

0xE

array of reference

1

package token (high bit on)

2

3

class token

4

5

0x0

padding

Method signatures are encoded in the same way, with the return type of the method encoded at the end of the sequence of nibbles. The return type is encoded in as many nibbles as required to represent it. For example:

Nibble

Value

Description

0

0x1

void

1

0x0

padding

Nibble

Value

Description

0

0x6

reference

1

package token (high bit on)

2

3

class token

4

5

0x4

short

javacard/jcvm/6.8.1_type_descriptor.txt · Last modified: 2017/05/13 04:10 (external edit)