⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jcvm06cap.html

📁 JAVA CARD 开发包规格说明,版本为2.2.2
💻 HTML
📖 第 1 页 / 共 5 页
字号:
</P><P CLASS="ParaIndent2"><A NAME="pgfId-9769"></A>The <KBD CLASS="Filename-Command">AID</KBD> item represents the Java Card platform name of the applet.</P><P CLASS="ParaIndent2"><A NAME="pgfId-24471"></A>Each applet is assigned an AID conforming to the ISO 7816-5 standard (<A HREF="JCVM04naming.html#28462" CLASS="XRef">Section 4.2, AID-based Naming</A>). The RID (first 5 bytes) of all of the applet AIDs must have the same value. In addition, the RID of each applet AIDs must have the same value as the RID of the package defined in this CAP file.</P><P CLASS="Paragraph"><A NAME="pgfId-24473"></A><KBD CLASS="Filename-Command">  install_method_offset</KBD></P><P CLASS="ParaIndent2"><A NAME="pgfId-9749"></A>The value of the <KBD CLASS="Filename-Command">install_method_offset</KBD> item must be a 16-bit offset into the <KBD CLASS="Filename-Command">info</KBD> item of the Method Component (<A HREF="JCVM06cap.html#30499" CLASS="XRef">Section 6.9, Method Component</A>). The item at that offset must be a <KBD CLASS="Filename-Command">method_info</KBD> structure that represents the <KBD CLASS="Filename-Command">static install(byte[],short,byte)</KBD> method of the applet.<A NAME="fnote3"></A><A HREF="#pgfId-24559"  CLASS="footnote"><SUP>[3]</SUP></A> The <KBD CLASS="Filename-Command">install(byte[],short,byte)</KBD> method must be defined in a class that extends the <KBD CLASS="Filename-Command">javacard.framework.applet</KBD> class, directly or indirectly. The <KBD CLASS="Filename-Command">install(byte[],short,byte)</KBD> method is called to initialize the applet.</P><H2 CLASS="Head1"><A NAME="pgfId-19555"></A><DIV><HR ALIGN=left SIZE=6 WIDTH=15% noshade></DIV>6.6	<A NAME="41659"></A>Import <A NAME="marker-54601"></A>Component</H2><P CLASS="Paragraph"><A NAME="pgfId-7228"></A>The Import Component lists the set of packages imported by the classes in this package. It does not include an entry for the package defined in this CAP file. The Import Component is represented by the following structure:</P><DIV CLASS="Code"><BR><TABLE CLASS="Code" BORDER=1 BORDERCOLORLIGHT="#FFFFFF" BORDERCOLORDARK="#000000" CELLPADDING=5 CELLSPACING=0 DIR="LTR"><TBODY><TR><TD SCOPE="ROW"><P CLASS="TableTextCode"><A NAME="pgfId-1012724"></A>import_component {</P><P CLASS="TableTextCode"><A NAME="pgfId-1012726"></A>     u1 tag</P><P CLASS="TableTextCode"><A NAME="pgfId-1012728"></A>     u2 size</P><P CLASS="TableTextCode"><A NAME="pgfId-1012730"></A>     u1 count</P><P CLASS="TableTextCode"><A NAME="pgfId-1012732"></A>     package_info packages[count]</P><P CLASS="TableTextCode"><A NAME="pgfId-1012734"></A>}</P></TD></TR></TBODY></TABLE><BR></DIV><P CLASS="Paragraph"><A NAME="pgfId-45782"></A>The items in the <KBD CLASS="Filename-Command">import_component</KBD> structure are as follows:</P><P CLASS="Paragraph"><A NAME="pgfId-7237"></A><KBD CLASS="Filename-Command">tag</KBD></P><P CLASS="ParaIndent1"><A NAME="pgfId-7238"></A>The <KBD CLASS="Filename-Command">tag</KBD> item has the value <KBD CLASS="Filename-Command">COMPONENT_Import</KBD> (4).</P><P CLASS="Paragraph"><A NAME="pgfId-7239"></A><KBD CLASS="Filename-Command">size</KBD></P><P CLASS="ParaIndent1"><A NAME="pgfId-7240"></A>The <KBD CLASS="Filename-Command">size</KBD> item indicates the number of bytes in the <KBD CLASS="Filename-Command">import_component</KBD> structure, excluding the <KBD CLASS="Filename-Command">tag</KBD> and <KBD CLASS="Filename-Command">size</KBD> items. The value of the <KBD CLASS="Filename-Command">size</KBD> item must be greater than zero.</P><P CLASS="Paragraph"><A NAME="pgfId-7241"></A><KBD CLASS="Filename-Command">count</KBD></P><P CLASS="ParaIndent1"><A NAME="pgfId-7242"></A>The <KBD CLASS="Filename-Command">count</KBD> item indicates the number of items in the <KBD CLASS="Filename-Command">packages</KBD> table. The value of the <KBD CLASS="Filename-Command">count</KBD> item must be between 0 and 128, inclusive.</P><P CLASS="Paragraph"><A NAME="pgfId-45644"></A><KBD CLASS="Filename-Command">packages[]</KBD></P><P CLASS="ParaIndent1"><A NAME="pgfId-45645"></A>The <KBD CLASS="Filename-Command">packages</KBD> item represents a table of variable-length <KBD CLASS="Filename-Command">package_info</KBD> structures as defined for package under <A HREF="JCVM06cap.html#24754" CLASS="XRef">Section 6.3, Header Component</A>. The table contains an entry for each of the packages referenced in the CAP file, not including the package defined.</P><P CLASS="ParaIndent1"><A NAME="pgfId-45649"></A>The major and minor version numbers specified in the <KBD CLASS="Filename-Command">package_info</KBD> structure are equal to the major and minor versions specified in the imported package's export file. See <A HREF="JCVM04naming.html#12240" CLASS="XRef">Section 4.5, Package Versions</A> for a description of assigning and using package version numbers.</P><P CLASS="ParaIndent1"><A NAME="pgfId-55024"></A>Components of this CAP file refer to an imported package by using a index in this packages table. The index is called a package token (<A HREF="JCVM04naming.html#13665" CLASS="XRef">Section 4.3.7.1, Package</A>).</P><H2 CLASS="Head1"><A NAME="pgfId-55032"></A><DIV><HR ALIGN=left SIZE=6 WIDTH=15% noshade></DIV>6.7	<A NAME="23719"></A>Constant Pool <A NAME="marker-55031"></A>Component</H2><P CLASS="Paragraph"><A NAME="pgfId-1000968"></A>The Constant Pool Component contains an entry for each of the classes, methods, and fields referenced by elements in the Method Component (<A HREF="JCVM06cap.html#30499" CLASS="XRef">Section 6.9, Method Component</A>) of this CAP file. The referencing elements in the Method Component may be instructions in the methods or exception handler catch types in the exception handler table.</P><P CLASS="Paragraph"><A NAME="pgfId-17690"></A>Entries in the Constant Pool Component reference elements in the Class Component (<A HREF="JCVM06cap.html#12321" CLASS="XRef">Section 6.8, Class Component</A>), Method Component (<A HREF="JCVM06cap.html#30499" CLASS="XRef">Section 6.9, Method Component</A>), and Static Field Component (<A HREF="JCVM06cap.html#40036" CLASS="XRef">Section 6.10, Static Field Component</A>). The Import Component (<A HREF="JCVM06cap.html#41659" CLASS="XRef">Section 6.6, Import Component</A>) is also accessed using a package token (<A HREF="JCVM04naming.html#13665" CLASS="XRef">Section 4.3.7.1, Package</A>) to describe references to classes, methods and fields defined in imported packages. Entries in the Constant Pool Component do not reference other entries internal to itself.</P><P CLASS="Paragraph"><A NAME="pgfId-17420"></A>The Constant Pool Component is described by the following structure:</P><DIV CLASS="Code"><BR><TABLE CLASS="Code" BORDER=1 BORDERCOLORLIGHT="#FFFFFF" BORDERCOLORDARK="#000000" CELLPADDING=5 CELLSPACING=0 DIR="LTR"><TBODY><TR><TD SCOPE="ROW"><P CLASS="TableTextCode"><A NAME="pgfId-1012810"></A>constant_pool_component {</P><P CLASS="TableTextCode"><A NAME="pgfId-1012812"></A>      u1 tag</P><P CLASS="TableTextCode"><A NAME="pgfId-1012814"></A>      u2 size</P><P CLASS="TableTextCode"><A NAME="pgfId-1012816"></A>      u2 count</P><P CLASS="TableTextCode"><A NAME="pgfId-1012818"></A>      cp_info constant_pool[count]</P><P CLASS="TableTextCode"><A NAME="pgfId-1012820"></A>}</P></TD></TR></TBODY></TABLE><BR></DIV><P CLASS="Paragraph"><A NAME="pgfId-7261"></A>The items in the <KBD CLASS="Filename-Command">constant_pool_component</KBD> structure are as follows:</P><P CLASS="Paragraph"><A NAME="pgfId-7262"></A><KBD CLASS="Filename-Command">tag</KBD></P><P CLASS="ParaIndent1"><A NAME="pgfId-7263"></A>The <KBD CLASS="Filename-Command">tag</KBD> item has the value <KBD CLASS="Filename-Command">COMPONENT_ConstantPool</KBD> (5).</P><P CLASS="Paragraph"><A NAME="pgfId-7264"></A><KBD CLASS="Filename-Command">size</KBD></P><P CLASS="ParaIndent1"><A NAME="pgfId-7265"></A>The <KBD CLASS="Filename-Command">size</KBD> item indicates the number of bytes in the <KBD CLASS="Filename-Command">constant_pool_component</KBD> structure, excluding the <KBD CLASS="Filename-Command">tag</KBD> and <KBD CLASS="Filename-Command">size</KBD> items. The value of the <KBD CLASS="Filename-Command">size</KBD> item must be greater than zero.</P><P CLASS="Paragraph"><A NAME="pgfId-7266"></A><KBD CLASS="Filename-Command">count</KBD></P><P CLASS="Paragraph"><A NAME="pgfId-7267"></A>The <KBD CLASS="Filename-Command">count</KBD> item represents the number entries in the <KBD CLASS="Filename-Command">constant_pool[]</KBD> array. Valid values are between 0 and 65535, inclusive.</P><P CLASS="Paragraph"><A NAME="pgfId-7268"></A><KBD CLASS="Filename-Command">constant_pool[]</KBD></P><P CLASS="ParaIndent1"><A NAME="pgfId-7269"></A>The <KBD CLASS="Filename-Command">constant_pool[]</KBD> item represents an array of <KBD CLASS="Filename-Command">cp_info</KBD> structures:</P><DIV CLASS="Code"><BR><TABLE CLASS="Code" BORDER=1 BORDERCOLORLIGHT="#FFFFFF" BORDERCOLORDARK="#000000" CELLPADDING=5 CELLSPACING=0 DIR="LTR"><TBODY><TR><TD SCOPE="ROW"><P CLASS="TableTextCode"><A NAME="pgfId-1012895"></A><KBD CLASS="Filename-Command">   cp_info {</KBD></P><P CLASS="TableTextCode"><A NAME="pgfId-1012897"></A><KBD CLASS="Filename-Command">       u1 tag</KBD></P><P CLASS="TableTextCode"><A NAME="pgfId-1012899"></A><KBD CLASS="Filename-Command">       u1 info[3]</KBD></P><P CLASS="TableTextCode"><A NAME="pgfId-1012901"></A><KBD CLASS="Filename-Command">   }</KBD></P></TD></TR></TBODY></TABLE><BR></DIV><P CLASS="ParaIndent1"><A NAME="pgfId-16841"></A>Each item in the <KBD CLASS="Filename-Command">constant_pool[]</KBD> array is a 4-byte structure. Each structure must begin with a 1-byte tag indicating the kind of <KBD CLASS="Filename-Command">cp_info</KBD> entry. The content and format of the 3-byte info array varies with the value of the tag. The valid tags and their values are listed in the following table.</P><BR><TABLE CLASS="Titled" BORDER=1 BORDERCOLORLIGHT="#FFFFFF" BORDERCOLORDARK="#000000" CELLPADDING=5 CELLSPACING=0 DIR="LTR"><CAPTION CLASS="TableCaption"><A NAME="pgfId-999146"> </A> TABLE 6-5 	CAP File Constant Pool Tags </CAPTION><THEAD><TR><TH SCOPE="COL" ROWSPAN="1" COLSPAN="1" BGCOLOR="#CCCCCC"><P CLASS="TableHead"><A NAME="pgfId-39181"></A>Constant Type</P></TH><TH SCOPE="COL" ROWSPAN="1" COLSPAN="1" BGCOLOR="#CCCCCC"><P CLASS="TableHead"><A NAME="pgfId-39183"></A>Tag</P></TH></TR></THEAD><TBODY><TR><TD SCOPE="ROW" ROWSPAN="1" COLSPAN="1"><P CLASS="TableTextCode"><A NAME="pgfId-39185"></A><KBD CLASS="Filename-Command">CONSTANT_Classref</KBD></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableTextCode"><A NAME="pgfId-39187"></A><KBD CLASS="Filename-Command">1</KBD></P></TD></TR><TR><TD SCOPE="ROW" ROWSPAN="1" COLSPAN="1"><P CLASS="TableTextCode"><A NAME="pgfId-39189"></A><KBD CLASS="Filename-Command">CONSTANT_InstanceFieldref</KBD></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableTextCode"><A NAME="pgfId-39191"></A><KBD CLASS="Filename-Command">2</KBD></P></TD></TR><TR><TD SCOPE="ROW" ROWSPAN="1" COLSPAN="1"><P CLASS="TableTextCode"><A NAME="pgfId-39193"></A><KBD CLASS="Filename-Command">CONSTANT_VirtualMethodref</KBD></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableTextCode"><A NAME="pgfId-39195"></A><KBD CLASS="Filename-Command">3</KBD></P></TD></TR><TR><TD SCOPE="ROW" ROWSPAN="1" COLSPAN="1"><P CLASS="TableTextCode"><A NAME="pgfId-39197"></A><KBD CLASS="Filename-Command">CONSTANT_SuperMethodref</KBD></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableTextCode"><A NAME="pgfId-39199"></A><KBD CLASS="Filename-Command">4</KBD></P></TD></TR><TR><TD SCOPE="ROW" ROWSPAN="1" COLSPAN="1"><P CLASS="TableTextCode"><A NAME="pgfId-39201"></A><KBD CLASS="Filename-Command">CONSTANT_StaticFieldref</KBD></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableTextCode"><A NAME="pgfId-39203"></A><KBD CLASS="Filename-Command">5</KBD></P></TD></TR><TR><TD SCOPE="ROW" ROWSPAN="1" COLSPAN="1"><P CLASS="TableTextCode"><A NAME="pgfId-39205"></A><KBD CLASS="Filename-Command">CONSTANT_StaticMethodref</KBD></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableTextCode"><A NAME="pgfId-39207"></A><KBD CLASS="Filename-Command">6</KBD></P></TD></TR></TBODY></TABLE><BR><P CLASS="ParaIndent1"><A NAME="pgfId-16829"></A>Java Card platform constant types (&quot;Java Card constant types&quot;) are more specific than those in Java class files. The categories indicate not only the type of the item referenced, but also the manner in which it is referenced. </P><P CLASS="ParaIndent1"><A NAME="pgfId-24571"></A>For example, in the Java constant pool there is one constant type for method references, while in the Java Card platform constant pool (&quot;Java Card constant pool&quot;) there are three constant types for method references: one for virtual method invocations using the <KBD CLASS="Filename-Command">invokevirtual</KBD> bytecode, one for super method invocations using the <KBD CLASS="Filename-Command">invokespecial</KBD> bytecode, and one for static method invocations using either the <KBD CLASS="Filename-Command">invokestatic</KBD> or <KBD CLASS="Filename-Command">invokespecial</KBD> bytecode.<A NAME="fnote4"></A><A HREF="#pgfId-24583"  CLASS="footnote"><SUP>[4]</SUP></A> The additional information provided by a constant type in Java Card technologies simplifies resolution of references.</P><P CLASS="ParaIndent1"><A NAME="pgfId-7314"></A>There are no ordering constraints on constant pool entries. It is recommended, however, that <KBD CLASS="Filename-Command">CONSTANT_InstanceFieldref</KBD> (<A HREF="JCVM06cap.html#15653" CLASS="XRef">Section 6.7.2, CONSTANT_InstanceFieldref, CONSTANT_VirtualMethodref, and CONSTANT_SuperMethodref</A>) constants occur early in the array to permit using <KBD CLASS="Filename-Command">getfield_T</KBD> and <KBD CLASS="Filename-Command">putfield_T</KBD> bytecodes instead of <Alt CLASS="InlineAltText">getfield_T_w</Alt> and <KBD CLASS="Filename-Command">putfield_T_w</KBD> bytecodes. The former have 1-byte constant pool index parameters while the latter have 2-byte constant pool index parameters.</P><P CLASS="ParaIndent1"><A NAME="pgfId-46280"></A>The first entry in the constant pool can not be an exception handler class that is referenced by a <KBD CLASS="Filename-Command">catch_type_index</KBD> of an <KBD CLASS="Filename-Command">exception_handler_info</KBD> structure. In such a case the value of the <KBD CLASS="Filename-Command">catch_type_index</KBD> would be equal to 0, but the value of 0 in a <KBD CLASS="Filename-Command">catch_type_index</KBD> is reserved to indicate an <KBD CLASS="Filename-Command">exception_handler_info</KBD> structure that describes a <EM CLASS="Emphasis">finally</EM> block.</P><H3 CLASS="Head2"><A NAME="pgfId-7315"></A>6.7.1	<A NAME="39801"></A>CONSTANT_Classref<A NAME="marker-54603"></A></H3><P CLASS="Paragraph"><A NAME="pgfId-7316"></A>The <KBD CLASS="Filename-Command">CONSTANT_Classref_info</KBD> structure is used to represent a reference to a class or an interface. The class or interface may be defined in this package or in an imported package. </P><DIV CLASS="Code"><BR><TABLE CLASS="Code" BORDER=1 BORDERCOLORLIGHT="#FFFFFF" BORDERCOLORDARK="#000000" CELLPADDING=5 CELLSPACING=0 DIR="LTR"><TBODY><TR><TD SCOPE="ROW"><P CLAS

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -