===== 6.4 Directory Component ===== The Directory Component lists the size of each of the components defined in this CAP file. When an optional component is not included, such as the Applet Component ([[6.5_Applet Component| Section 6.5, Applet Component]]), Export Component ([[6.12_Export Component| Section 6.12, Export Component]]), or Debug Component ([[6.14_Debug Component| Section 6.14, Debug Component]]), it is represented in the Directory Component with size equal to zero. The Directory Component also includes entries for new (or custom) components. The Directory Component is described by the following variable-length structure: The items in the **directory_component** structure are as follows: **tag** The tag item has the value **COMPONENT_Directory** (2). **size** The ******size****** item indicates the number of bytes in the **directory_component** structure, excluding the **tag** and ******size****** items. The value of the ******size****** item must be greater than zero. **component_sizes[]** The ****component_sizes**** item is an array representing the number of bytes in each of the components in this CAP file. All of the 12 components defined in this chapter are represented in the ****component_sizes**** array. The value of an index into the array is equal to the value of the tag of the component represented at that entry, minus 1. The value in each entry in the **component_**size**s** array is the same as the **size** item in the corresponding component. It represents the number of bytes in the component, excluding the **tag** and **size** items. The value of an entry in the **component_sizes** array is zero for components not included in this CAP file. Components that may not be included are the Applet Component ([[6.5_Applet Component| Section 6.5, Applet Component]]), the Export Component ([[6.12_Export Component| Section 6.12, Export Component]]), and the Debug Component ([[6.14_Debug Component| Section 6.14, Debug Component]]). For all other components the value is greater than zero. **static_field_size** The **static_field_size** item is a **static_field_size**_info structure. The structure is defined as: The items in the **static_field_size_info** structure are the following: ** image_size** The ****image_size**** item has the same value as the ****image_size**** item in the Static Field Component ([[6.10_Static Field Component| Section 6.10, Static Field Component]]). It represents the total number of bytes in the ****static**** fields defined in this package, excluding final ****static**** fields of primitive types. ** array_init_count** The ****array_init_count**** item has the same value as the ****array_init_count**** item in the Static Field Component ([[6.10_Static Field Component| Section 6.10, Static Field Component]]). It represents the number of arrays initialized in all of the **** methods in this package. ** array_init_size** The ****array_init**_size** item represents the sum of the count items in the **array_init** table item of the Static Field Component ([[6.10_Static Field Component| Section 6.10, Static Field Component]]). It is the total number of bytes in all of the arrays initialized in all of the **** methods in this package. **import_count** The **import_count** item indicates the number of packages imported by classes and interfaces in this package. This item has the same value as the count item in the Import Component ([[6.6_Import Component| Section 6.6, Import Component]]). **applet_count** The ******applet_count****** item indicates the number of applets defined in this package. If an Applet Component [[6.5_Applet Component| Section 6.5, Applet Component]]) is not included in this CAP file, the value of the ******applet_count****** item is zero. Otherwise the value of the ******applet_count****** item is the same as the value of the count item in the Applet Component ([[6.5_Applet Component| Section 6.5, Applet Component]]). **custom_count** The **custom_count** item indicates the number of entries in the **custom_components** table. Valid values are between 0 and 127, inclusive. **custom_components[]** The **custom_components** item is a table of variable-length **custom_component_info** structures. Each new component defined in this CAP file must be represented in the table. These components are not defined in this standard. The **custom_component_info** structure is defined as: The items in entries of the **custom_component_info** structure are: ** component_tag** The **component_tag** item represents the tag of the component. Valid values are between 128 and 255, inclusive. ** size** The ****size**** item represents the number of bytes in the component, excluding the **tag** and ****size**** items. ** AID_length** The ****AID**_length** item represents the number of bytes in the **AID** item. Valid values are between 5 and 16, inclusive. ** AID[]** The **AID** item represents the Java Card platform name of the component. See ISO 7816-5 for the definition of an **AID** ([[4.2_**AID**-based Naming| Section 4.2, **AID**-based Naming]]). Each component is assigned an **AID** conforming to the ISO 7816-5 standard. Beyond that, there are no constraints on the value of an **AID** of a custom component.