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

📄 jcvm04naming.html

📁 JAVA CARD 开发包规格说明,版本为2.2.2
💻 HTML
📖 第 1 页 / 共 4 页
字号:
RID and a PIX for that package. This AID corresponds to the string namefor the package, as shown in <a href="JCVM04naming.html#10025" class="XRef">FIGURE 4-1</a>.<br><br></p><a name="pgfId-1002238"> </a><a name="pgfId-1002244"></a><a name="10025" style="font-weight: bold;"> </a><span style="font-weight: bold;"> FIGURE 4-1 Mapping Package Identifiers ToAIDs</span><p class="FigureBox"><img src="figures/JCVM04naming-4.jpg" align="bottom"></p><p class="Paragraph"><a name="pgfId-1008049"></a></p><p class="Paragraph"><a name="pgfId-998883"></a>Each applet installedon a Java Card technology enabled device must also have a unique AID.This AID is constructed similarly to a package AID. It is aconcatenation of the applet provider's RID and PIX for that applet. Anapplet AID must not have the same value as the AID of any package orthe AID of any other applet. The RID of each applet in a package mustbe the same as the RID of the package.</p><p class="Paragraph"><a name="pgfId-8344"></a>Custom components definedin a CAP file are also identified using AIDs. Like AIDs for applets andpackages, component AIDs are formed by concatenating a RID and a PIX. </p><h2 class="Head1"><a name="pgfId-8004"></a><div><hr align="left" size="6" width="15%" noshade="noshade"></div>4.3 <a name="marker-14179"></a>Token-based Linking</h2><p class="Paragraph"><a name="pgfId-8011"></a>This section describes ascheme that allows downloaded software to be linked against APIs on aJava Card technology enabled device. The scheme represents referenceditems as opaque tokens, instead of Unicode strings as are used in Javaclass files. The two basic requirements of this linking scheme are thatit allows linking on the device, and that it does not require internalimplementation details of APIs to be revealed to clients of those APIs.Secondary requirements are that the scheme be efficient in terms ofresource use on the device, and have acceptable performance forlinking. And of course, it must preserve the semantics of the Javalanguage.</p><h3 class="Head2"><a name="pgfId-8006"></a>4.3.1 <a name="marker-14180"></a>ExternallyVisible Items</h3><p class="Paragraph"><a name="pgfId-8007"></a>Classes (includingInterfaces) in Java packages may be declared with public or packagevisibility. A class's methods and fields may be declared with public,protected, package or private visibility. For purposes of thisdocument, we define public classes, public or protected fields, andpublic or protected methods to be externally visible from the package.</p><p class="Paragraph"><a name="pgfId-6956"></a>Each externally visibleitem must have a token associated with it to enable references fromother packages to the item to be resolved on a device. There are sixkinds of items in a package that require external identification.</p><ul>  <li class="Bullet1"><a name="pgfId-6957"></a>Classes (includingInterfaces) </li>  <p class="Linebreak"> </p>  <li class="Bullet1-"><a name="pgfId-6958"></a>Static Fields </li>  <p class="Linebreak"> </p>  <li class="Bullet1-"><a name="pgfId-6959"></a>Static Methods </li>  <p class="Linebreak"> </p>  <li class="Bullet1-"><a name="pgfId-6960"></a>Instance Fields </li>  <p class="Linebreak"> </p>  <li class="Bullet1-"><a name="pgfId-6961"></a>Virtual Methods </li>  <p class="Linebreak"> </p>  <li class="Bullet1-"><a name="pgfId-6962"></a>Interface Methods </li>  <p class="Linebreak"> </p></ul><h3 class="Head2"><a name="pgfId-6963"></a>4.3.2 <a name="marker-14181"></a>PrivateTokens</h3><p class="Paragraph"><a name="pgfId-6964"></a>Items that are notexternally visible are internally visible. Internally visible items arenot described in a package's export file, but some such items useprivate tokens to represent internal references. External referencesare represented by <a name="marker-14182"></a>public tokens. There arethree kinds of items that can be assigned private tokens.</p><ul>  <li class="Bullet1"><a name="pgfId-6965"></a>Instance Fields </li>  <p class="Linebreak"> </p>  <li class="Bullet1-"><a name="pgfId-6966"></a>Virtual Methods </li>  <p class="Linebreak"> </p>  <li class="Bullet1-"><a name="pgfId-13632"></a>Packages </li>  <p class="Linebreak"> </p></ul><h3 class="Head2"><a name="pgfId-6967"></a>4.3.3 <a name="12405"></a>TheExport File<a name="marker-14183"></a> and Conversion</h3><p class="Paragraph"><a name="pgfId-1001549"></a>An export filecontains entries for externally visible items in the package. Eachentry holds the item's name and its token. Some entries may includeadditional information as well. For detailed information on the exportfile format, see <a href="JCVM05export.html#26841" class="XRef">Chapter5</a>, "The Export File Format".</p><p class="Paragraph"><a name="pgfId-1001553"></a>The export file isused to map names for imported items to tokens during packageconversion. The Java Card converter uses these tokens to representreferences to items in an imported package.</p><p class="Paragraph"><a name="pgfId-6971"></a>For example, during theconversion of the class files of applet A, the export file ofjavacard.framework is used to find tokens for items in the API that areused by the applet. Applet A creates a new instance of framework classOwnerPIN. The framework export file contains an entry forjavacard.framework.OwnerPIN that holds the token for this class. Theconverter places this token in the CAP file's constant pool torepresent an unresolved reference to the class. The token value islater used to resolve the reference on a device.</p><h3 class="Head2"><a name="pgfId-6972"></a>4.3.4 <a name="marker-14184"></a>References- External and Internal</h3><p class="Paragraph"><a name="pgfId-6973"></a>In the context of a CAPfile, references to items are made indirectly through a package'sconstant pool. References to items in other packages are calledexternal, and are represented in terms of tokens. References to itemsin the same CAP file are called internal, and are represented either interms of tokens, or in a different internal format.</p><p class="Paragraph"><a name="pgfId-6974"></a>An external reference toa class is composed of a package token and a class token. Togetherthose tokens specify a certain class in a certain package. An internalreference to a class is a 15-bit value that is a pointer to the classstructure's location within the CAP file.</p><p class="Paragraph"><a name="pgfId-6975"></a>An external reference toa static class member, either a field or method, consists of a packagetoken, a class token, and a token for the static field or staticmethod. An internal reference to a static class member is a 16-bitvalue that is a pointer to the item's location in the CAP file.</p><p class="Paragraph"><a name="pgfId-6976"></a>References to instancefields, virtual methods and interface methods consist of a classreference and a token of the appropriate type. The class referencedetermines whether the reference is external or internal.</p><h3 class="Head2"><a name="pgfId-6977"></a>4.3.5 Installation and <a name="marker-14185"></a>Linking</h3><p class="Paragraph"><a name="pgfId-6978"></a>External references in aCAP file can be resolved on a device from token form into the internalrepresentation used by the virtual machine.</p><p class="Paragraph"><a name="pgfId-6979"></a>A token can only beresolved in the context of the package that defines it. Just as theexport file maps from a package's externally visible names to tokens,there is a set of link information for each package on the device thatmaps from tokens to resolved references.</p><h3 class="Head2"><a name="pgfId-6980"></a>4.3.6 Token <a name="marker-14186"></a>Assignment</h3><p class="Paragraph"><a name="pgfId-6981"></a>Tokens for an API areassigned by the API's owner and published in the package export file(s)for that API. Since the name-to-token mappings are published, an APIowner may choose any order for tokens (subject to the constraintslisted below).</p><p class="Paragraph"><a name="pgfId-6982"></a>A particular deviceplatform can resolve tokens into whatever internal representation ismost useful for that implementation of a Java Card virtual machine.Some tokens may be resolved to indices. For example, an instance fieldtoken may be resolved to an index into a class instance's fields. Insuch cases, the token value is distinct from and unrelated to the valueof the resolved index.</p><h3 class="Head2"><a name="pgfId-6983"></a>4.3.7 Token <a name="marker-14187"></a>Details</h3><p class="Paragraph"><a name="pgfId-8356"></a>Each kind of item in apackage has its own independent scope for tokens of that kind. Thetoken range and assignment rules for each kind are listed in <a href="JCVM04naming.html#81010" class="XRef">TABLE 4-2</a>.</p><br><table class="Titled" border="1" bordercolorlight="#FFFFFF" bordercolordark="#000000" cellpadding="5" cellspacing="0" dir="ltr">  <caption class="TableCaption"><a name="pgfId-998344"> </a> TABLE 4-2<br>  <a name="81010"> </a> Token Range, Type and Scope </caption> <thead><tr>    <th scope="col" rowspan="1" colspan="1" bgcolor="#cccccc">    <p class="TableHead"><a name="pgfId-998277"></a>Token Type </p>    </th>    <th scope="col" rowspan="1" colspan="1" bgcolor="#cccccc">    <p class="TableHead"><a name="pgfId-998279"></a>Range </p>    </th>    <th scope="col" rowspan="1" colspan="1" bgcolor="#cccccc">    <p class="TableHead"><a name="pgfId-998281"></a>Type </p>    </th>    <th scope="col" rowspan="1" colspan="1" bgcolor="#cccccc">    <p class="TableHead"><a name="pgfId-998283"></a>Scope </p>    </th>  </tr>  </thead> <tbody>    <tr>      <td scope="row" rowspan="1" colspan="1">      <p class="TableText"><a name="pgfId-998285"></a>Package </p>      </td>      <td rowspan="1" colspan="1">      <p class="TableText"><a name="pgfId-998287"></a>0 - 127 </p>      </td>      <td rowspan="1" colspan="1">      <p class="TableText"><a name="pgfId-998289"></a>Private </p>      </td>      <td rowspan="1" colspan="1">      <p class="TableText"><a name="pgfId-998291"></a>Package </p>      </td>    </tr>    <tr>      <td scope="row" rowspan="1" colspan="1">      <p class="TableText"><a name="pgfId-998293"></a>Class </p>      </td>      <td rowspan="1" colspan="1">      <p class="TableText"><a name="pgfId-998295"></a>0 - 254 </p>      </td>      <td rowspan="1" colspan="1">      <p class="TableText"><a name="pgfId-998297"></a>Public </p>      </td>      <td rowspan="1" colspan="1">      <p class="TableText"><a name="pgfId-998299"></a>Package </p>      </td>    </tr>    <tr>      <td scope="row" rowspan="1" colspan="1">      <p class="TableText"><a name="pgfId-998301"></a>Static Field </p>      </td>      <td rowspan="1" colspan="1">      <p class="TableText"><a name="pgfId-998303"></a>0 - 255 </p>      </td>      <td rowspan="1" colspan="1">      <p class="TableText"><a name="pgfId-998305"></a>Public </p>      </td>      <td rowspan="1" colspan="1">      <p class="TableText"><a name="pgfId-998307"></a>Class </p>      </td>    </tr>    <tr>      <td scope="row" rowspan="1" colspan="1">      <p class="TableText"><a name="pgfId-998309"></a>Static Method </p>      </td>      <td rowspan="1" colspan="1">      <p class="TableText"><a name="pgfId-998311"></a>0 - 255 </p>      </td>      <td rowspan="1" colspan="1">      <p class="TableText"><a name="pgfId-998313"></a>Public </p>      </td>      <td rowspan="1" colspan="1">      <p class="TableText"><a name="pgfId-998315"></a>Class </p>      </td>    </tr>    <tr>

⌨️ 快捷键说明

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