Site Tools


Smart Card Solution

User Manual

JavaCard API Samples

Java Card Specification

Knowledge Sharing


6.9 Method Component

The Method Component describes each of the methods declared in this package, excluding methods and interface method declarations. Abstract methods defined by classes (not interfaces) are included. The exception handlers associated with each method are also described.

The Method Component does not contain complete access information and descriptive details for each method. Instead, the information is optimized for size and therefore limited to that required to execute each method without performing verification. Complete details regarding the methods defined in this package are included in the Descriptor Component ( Section 6.13, Descriptor Component). Among other information, the Descriptor Component contains the location and number of bytecodes for each method in the Method Component. This information can be used to parse the methods in the Method Component.

Instructions and exception handler catch types in the Method Component reference entries in the Constant Pool Component ( Section 6.7, Constant Pool Component). No other CAP file components, including the Method Component, are referenced by the elements in the Method Component.

The Applet Component ( Section 6.5, Applet Component), Constant Pool Component ( Section 6.7, Constant Pool Component), Class Component ( Section 6.8, Class Component), Export Component ( Section 6.12, Export Component), Descriptor Component ( Section 6.13, Descriptor Component), and Debug Component ( Section 6.14, Debug Component) reference methods defined in the Method Component. The Reference Location Component ( Section 6.11, Reference Location Component) references all constant pool indices contained in the Method Component. No other CAP file components reference the Method Component.

The Method Component is represented by the following structure:

The items in the method_component structure are as follows:


The tag item has the value COMPONENT_Method (7).


The size item indicates the number of bytes in the method_component structure, excluding the tag and size items. The value of the size item must be greater than zero.


The handler_count item represents the number of entries in the exception_handlers array. Valid values are between 0 and 255, inclusive.


The exception_handlers item represents an array of 8-byte exception_handler_info structures. Each exception_handler_info structure represents a catch or finally block defined in a method of this package.

Entries in the exception_handlers array are sorted in ascending order by the the offset to the handler of the exception handler. Smaller offset values occur first in the array. This ordering constraint ensures that the first match found when searching for an exception handler is the correct match.

There are two consequences of this ordering constraint. First, a handler that is nested with the active range (try block) of another handler occurs first in the array. Second, when multiple handlers are associated with the same active range, they are ordered as they occur in a method. This is consistent with the ordering constraints defined for Java class files. An example is shown below.

The methods item represents a table of variable-length method_info structures. Each entry represents a method declared in a class of this package. methods and interface method declaration are not included; all other methods, including non-interface abstract methods, are.

javacard/jcvm/6.9_method_component.txt · Last modified: 2017/05/13 04:12 (external edit)