jcrespec08rmi.html

来自「JAVA CARD 开发包规格说明,版本为2.2.2」· HTML 代码 · 共 1,195 行 · 第 1/5 页

HTML
1,195
字号
<PRE CLASS="ScreenText"><A NAME="pgfId-428745"></A>    union {</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-428747"></A>        ref_null remote_ref_null</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-428749"></A>        remote_ref_with_class remote_ref_c</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-428751"></A>        remote_ref_with_interfaces remote_ref_i</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-428753"></A>        }</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-428755"></A>}</PRE></TD></TR></TBODY></TABLE><BR></DIV><BR><HR NOSHADE SIZE=1><TABLE CLASS="TipNote" DIR="LTR" WIDTH="100%" SUMMARY="TipNote"><COLGROUP SPAN="1" WIDTH="100%"><TR ALIGN="left" VALIGN="top"><TD ROWSPAN="1" COLSPAN="1" ABBR="TipNoteText"><P CLASS="TipNote"><B CLASS="TipNote">Note - </B><A NAME="pgfId-416776"></A>Even though this structure uses the C-like &quot;union&quot; notation, the lengths of the alternate representations within the union do not use any padding to normalize their lengths.</P></TD></TR></TABLE><HR NOSHADE SIZE=1><BR><P CLASS="Paragraph"><A NAME="pgfId-416791"></A>The following items are in the <KBD CLASS="Filename-Command">remote_ref_descriptor</KBD> structure:</P><P CLASS="ParaIndent1"><A NAME="pgfId-416799"></A><KBD CLASS="Filename-Command">ref_null</KBD> is the representation of a null reference using the following format:</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"><PRE CLASS="ScreenText"><A NAME="pgfId-429089"></A>ref_null {</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-429091"></A>   u2 remote_ref_id = 0xFFFF</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-429093"></A>}</PRE></TD></TR></TBODY></TABLE><BR></DIV><P CLASS="ParaIndent1"><A NAME="pgfId-429095"></A>The <KBD CLASS="Filename-Command">remote_ref_id</KBD> item must be the reserved value <KBD CLASS="Filename-Command">0xFFFF</KBD>.</P><P CLASS="ParaIndent1"><A NAME="pgfId-429034"></A><KBD CLASS="Filename-Command">remote_ref_with_class</KBD> is the definition of a remote object reference using the class name and uses the following format:</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"><PRE CLASS="ScreenText"><A NAME="pgfId-429037"></A>remote_ref_with_class {</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-429039"></A>      u2 remote_ref_id != 0xFFFF</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-429041"></A>      u1 hash_modifier_length</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-429043"></A>      u1 hash_modifier[ hash_modifier_length ]</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-429045"></A>      u1 pkg_name_length</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-429047"></A>      u1 package_name[ pkg_name_length ]</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-429049"></A>      u1 class_name_length</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-429051"></A>      u1 class_name[ class_name_length ]</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-429053"></A>    }</PRE></TD></TR></TBODY></TABLE><BR></DIV><P CLASS="ParaIndent1"><A NAME="pgfId-429055"></A>The <KBD CLASS="Filename-Command">remote_ref_id</KBD> item represents the remote reference identifier. The value of this field must not be <KBD CLASS="Filename-Command">0xFFFF</KBD>, which denotes the <KBD CLASS="Filename-Command">null</KBD> reference.</P><P CLASS="ParaIndent1"><A NAME="pgfId-416895"></A>The <KBD CLASS="Filename-Command">hash_modifier</KBD> item is an UTF-8 string of length specified in the <KBD CLASS="Filename-Command">hash_modifier</KBD>_length item and is used to ensure that method identifier hash codes are unique.</P><P CLASS="ParaIndent1"><A NAME="pgfId-416898"></A>The <KBD CLASS="Filename-Command">pkg_name_length</KBD> item is the number of bytes in the <KBD CLASS="Filename-Command">package_name</KBD> item to represent the name of the package in UTF-8 string notation. The value of this item must be non-zero.</P><P CLASS="ParaIndent1"><A NAME="pgfId-416901"></A>The <KBD CLASS="Filename-Command">package_name</KBD> item is the variable length representation of the fully qualified name of the package which contains the remote class in UTF-8 string notation. The fully qualified name of the package represented here uses the internal form wherein the ASCII periods (<KBD CLASS="Filename-Command">.</KBD>) that normally separate the indentifiers that make up the fully qualified name are replaced by ASCII forward slashes (<KBD CLASS="Filename-Command">/</KBD>). For example, the internal form of the normally fully qualified package name of the package <KBD CLASS="Filename-Command">java.rmi</KBD> is <KBD CLASS="Filename-Command">java/rmi</KBD>.</P><P CLASS="ParaIndent1"><A NAME="pgfId-416903"></A>The <KBD CLASS="Filename-Command">class_name_length</KBD> item is the number of bytes in the <KBD CLASS="Filename-Command">class_name</KBD> item to represent the name of the remote class in UTF-8 string notation. The value of this item must be non-zero.</P><P CLASS="ParaIndent1"><A NAME="pgfId-416906"></A>The <KBD CLASS="Filename-Command">class_name</KBD> item is the variable length representation of the name of the implementation class (or superclass) of the remote object in UTF-8 string notation. The class referenced in the remote object reference descriptor must directly implement a remote interface. If the implementation class of the remote object does not directly implement a remote interface, the class name of the &quot;closest&quot; superclass of the implementation class which directly implements a remote interface must be used.</P><P CLASS="Paragraph"><A NAME="pgfId-416964"></A><KBD CLASS="Filename-Command">remote_ref_with_interfaces</KBD> item is the definition of a remote object reference using the names of the interfaces and uses the following format:</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"><PRE CLASS="ScreenText"><A NAME="pgfId-428858"></A>remote_ref_with_interfaces {</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-428860"></A><KBD CLASS="Filename-Command">      u2 remote_ref_id != 0xFFFF</KBD></PRE><PRE CLASS="ScreenText"><A NAME="pgfId-428862"></A><KBD CLASS="Filename-Command">      u1 hash_modifier_length</KBD></PRE><PRE CLASS="ScreenText"><A NAME="pgfId-428864"></A><KBD CLASS="Filename-Command">      u1 hash_modifier[ hash_modifier_length ]</KBD></PRE><PRE CLASS="ScreenText"><A NAME="pgfId-428866"></A><KBD CLASS="Filename-Command">      u1 remote_interface_count</KBD></PRE><PRE CLASS="ScreenText"><A NAME="pgfId-428868"></A><KBD CLASS="Filename-Command">      rem_interface_def remote_interfaces[remote_interface_count]</KBD></PRE><PRE CLASS="ScreenText"><A NAME="pgfId-428870"></A><KBD CLASS="Filename-Command">   }</KBD></PRE></TD></TR></TBODY></TABLE><BR></DIV><P CLASS="ParaIndent1"><A NAME="pgfId-417008"></A>The definition of the <KBD CLASS="Filename-Command">remote_ref_id</KBD>, the <KBD CLASS="Filename-Command">hash_modifier_length</KBD> and the <KBD CLASS="Filename-Command">hash_modifier</KBD> item are the same as that described earlier in the <KBD CLASS="Filename-Command">remote_ref_with_class</KBD> structure.</P><P CLASS="ParaIndent1"><A NAME="pgfId-417011"></A>The <KBD CLASS="Filename-Command">remote_interface_count</KBD> item indicates the number of <KBD CLASS="Filename-Command">rem_interface_def</KBD> format entries in the <KBD CLASS="Filename-Command">remote_interfaces</KBD> item. This number must be less than 16.</P><P CLASS="ParaIndent1"><A NAME="pgfId-417014"></A>The <KBD CLASS="Filename-Command">remote_interfaces</KBD> item comprises a sufficient list of <KBD CLASS="Filename-Command">rem_interface_def</KBD> format entries containing the names of remote interfaces implemented. This list is such that when combined with their remote superinterfaces, the complete set of remote interfaces implemented by the remote object can be enumerated. The <KBD CLASS="Filename-Command">rem_interface_def</KBD> item uses the following format:</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"><PRE CLASS="ScreenText"><A NAME="pgfId-428874"></A>rem_interface_def {</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-428876"></A>      u1 pkg_name_length</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-428878"></A>      u1 package_name[ pkg_name_length ]</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-428880"></A>      u1 interface_name_length</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-428882"></A>      u1 interface_name[ interface_name_length ]</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-428884"></A>      }</PRE></TD></TR></TBODY></TABLE><BR></DIV><P CLASS="ParaIndent1"><A NAME="pgfId-417092"></A>The items in the <KBD CLASS="Filename-Command">rem_interface_def</KBD> structure are as follows:</P><P CLASS="ParaIndent1"><A NAME="pgfId-417093"></A>The <KBD CLASS="Filename-Command">pkg_name_length</KBD> item is the number of bytes used in the <KBD CLASS="Filename-Command">package_name</KBD> item to represent the name of the package in UTF-8 string notation. If the value of this item is <KBD CLASS="Filename-Command">0</KBD>, it indicates that the package name of the previous <KBD CLASS="Filename-Command">remote_interfaces</KBD> item must be used instead. The value of this item in <KBD CLASS="Filename-Command">remote_interfaces[0]</KBD> must not be <KBD CLASS="Filename-Command">0</KBD>.</P><P CLASS="ParaIndent1"><A NAME="pgfId-417098"></A>The <KBD CLASS="Filename-Command">package_name</KBD> item is the <KBD CLASS="Filename-Command">pkg_name_length</KBD> byte length representation of the fully qualified name of the package which contains the remote interface in UTF-8 string notation. The fully qualified name of the package represented here uses the internal form wherein the ASCII periods (<KBD CLASS="Filename-Command">.</KBD>) that normally separate the indentifiers that make up the fully qualified name are replaced by ASCII forward slashes (<KBD CLASS="Filename-Command">/</KBD>). For example, the internal form of the normally fully qualified package name of the package <KBD CLASS="Filename-Command">java.rmi</KBD> is <KBD CLASS="Filename-Command">java/rmi</KBD>.</P><P CLASS="ParaIndent1"><A NAME="pgfId-417101"></A>The <KBD CLASS="Filename-Command">interface_name_length</KBD> item is the number of bytes in the <KBD CLASS="Filename-Command">interface_name</KBD> item to represent the name of the remote interface in UTF-8 string notation.</P><P CLASS="ParaIndent1"><A NAME="pgfId-417104"></A>The <KBD CLASS="Filename-Command">interface_name</KBD> item is the variable length representation of the name of the remote interface implemented by the remote object in UTF-8 string notation.</P><H3 CLASS="Head2"><A NAME="pgfId-411259"></A>8.3.3	<A NAME="marker-420185"></A>Method Identifier</H3><P CLASS="Paragraph"><A NAME="pgfId-427400"></A>A method identifier is always used in association with a remote object reference. A method identifier is defined as follows:</P><PRE CLASS="Codeline"><A NAME="pgfId-416229"></A><KBD CLASS="Filename-Command">u2 method_id</KBD></PRE><P CLASS="Paragraph"><A NAME="pgfId-412420"></A>The <KBD CLASS="Filename-Command">method_id</KBD> is a unique 16-bit hashcode identifier of the remote method within the remote class. This 16-bit hashcode consists of the first two bytes of the SHA-1 message digest function performed on a class specific hash modifier string, followed by the name of the method, followed by the method descriptor representation in UTF-8 format. Representation of a method descriptor is the same as that described in <EM CLASS="Emphasis">The Java Virtual Machine Specification</EM> (Section 4.3.3).</P><H3 CLASS="Head2"><A NAME="pgfId-412421"></A>8.3.4	<A NAME="80609"></A>Parameter <A NAME="marker-420186"></A>Encoding</H3><P CLASS="Paragraph"><A NAME="pgfId-427405"></A>Every parameter has the following generic format:</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"><PRE CLASS="ScreenText"><A NAME="pgfId-429154"></A>param {</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-429175"></A>      u1 value[]</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-429185"></A>    }</PRE></TD></TR></TBODY></TABLE><BR></DIV><H4 CLASS="Head3"><A NAME="pgfId-411390"></A>8.3.4.1	Primitive Data Type Parameter Encoding</H4><P CLASS="Paragraph"><A NAME="pgfId-427417"></A>Primitive data types <KBD CLASS="Filename-Command">void</KBD>, <KBD CLASS="Filename-Command">boolean</KBD>, <KBD CLASS="Filename-Command">byte</KBD>, <KBD CLASS="Filename-Command">short</KBD> and <KBD CLASS="Filename-Command">int</KBD> are respectively encoded as follows:</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"><PRE CLASS="ScreenText"><A NAME="pgfId-429201"></A>void_param {</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-429203"></A>    }</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-429205"></A>boolean_param {</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-429207"></A>      u1 boolean_value</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-429209"></A>    }</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-429211"></A>byte_param {</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-429213"></A>      s1 byte_value</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-429262"></A>    }</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-429260"></A>short_param {</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-429258"></A>      s2 short_value</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-429256"></A>    }</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-429254"></A>int_param {</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-429252"></A>      s4 int_value</PRE><PRE CLASS="ScreenText"><A NAME="pgfId-429250"></A>    }</PRE></TD></TR></TBODY></TABLE><BR></DIV><P CLASS="Paragraph"><A NAME="pgfId-411399"></A>The <KBD CLASS="Filename-Command">boolean_value</KBD> field may only take the values <KBD CLASS="Filename-Command">0</KBD> (for <KBD CLASS="Filename-Command">false</KBD>) and <KBD CLASS="Filename-Command">1</KBD> (for <KBD CLASS="Filename-Command">true</KBD>). All the other fields can take any value in their range.</P><H4 CLASS="Head3"><A NAME="pgfId-412765"></A>8.3.4.2	Array Parameter Encoding</H4><P CLASS="Paragraph"><A NAME="pgfId-427432"></A>The representation of the null array parameter and arrays of the <KBD CLASS="Filename-Command">boolean</KBD>, <KBD CLASS="Filename-Command">byte</KBD>, <KBD CLASS="Filename-Command">short</KBD> and <KBD CLASS="Filename-Command">int</KBD> component types include the length information and are respectively encoded as follows:</P>

⌨️ 快捷键说明

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