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

📄 classfile.doc.html

📁 A Java virtual machine instruction consists of an opcode specifying the operation to be performed, f
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<p><pre><br><a name="20787"></a>&nbsp;&nbsp;&nbsp;&nbsp;<code>CONSTANT_Long_info {</code>&nbsp;&nbsp;&nbsp;&nbsp;<code>	u1 tag;</code>&nbsp;&nbsp;&nbsp;&nbsp;<code>	u4 high_bytes;</code>&nbsp;&nbsp;&nbsp;&nbsp;<code>	u4 low_bytes;</code><a name="20790"></a>&nbsp;&nbsp;&nbsp;&nbsp;<code>}</code><br><br><a name="21702"></a>&nbsp;&nbsp;&nbsp;&nbsp;<code>CONSTANT_Double_info {</code>&nbsp;&nbsp;&nbsp;&nbsp;<code>	u1 tag;</code>&nbsp;&nbsp;&nbsp;&nbsp;<code>	u4 high_bytes;</code>&nbsp;&nbsp;&nbsp;&nbsp;<code>	u4 low_bytes;</code><a name="21696"></a>&nbsp;&nbsp;&nbsp;&nbsp;<code>}</code><br></pre><a name="16625"></a>All 8-byte constants take up two entries in the <code>constant_pool</code> table of the <code>class</code> file. If a <code>CONSTANT_Long_info</code> or <code>CONSTANT_Double_info</code> structure is the item in the <code>constant_pool</code> table at index <code>n</code>, then the next usable item in the pool is located at index <code>n</code>+<code>2</code>. The <code>constant_pool</code> index <code>n</code>+<code>1</code> must be valid but is considered unusable.<a href="#16628"><sup>2</sup></a><p><a name="63028"></a>The items of these structures are as follows:<p><a name="7309"></a><dl><dt><code>tag</code><dd> The <code>tag</code> item of the <code>CONSTANT_Long_info</code> structure has the value <code>CONSTANT_Long</code> (<code>5</code>).<p>The <code>tag</code> item of the <code>CONSTANT_Double_info</code> structure has the value <code>CONSTANT_Double</code> (<code>6</code>).<p><a name="20793"></a><dt><code>high_bytes</code>, <code>low_bytes</code><dd> The unsigned <code>high_bytes</code> and <code>low_bytes</code> items of the <code>CONSTANT_Long_info</code> structure together represent the value of the <code>long</code> constant ((<code>long</code>) <code>high_bytes</code> << 32) + <code>low_bytes</code>, where the bytes of each of <code>high_bytes</code> and <code>low_bytes</code> are stored in big-endian (high byte first) order.<p>The <code>high_bytes</code> and <code>low_bytes</code> items of the <code>CONSTANT_Double_info</code> structure together represent the <code>double</code> value in IEEE 754 floating-point double format <a href="Overview.doc.html#28147">(&#167;3.3.2)</a>. The bytes of each item are stored in big-endian (high byte first) order.<p>The value represented by the <code>CONSTANT_Double_info</code> structure is determined as follows. The <code>high_bytes</code> and <code>low_bytes</code> items are first converted into the <code>long</code> constant bits, which is equal to ((<code>long</code>) <code>high_bytes</code> << 32) + <code>low_bytes</code>. Then:<p><ul><li>If bits is <code>0x7ff0000000000000L</code>, the <code>double</code> value will be  positive infinity.<li>If bits is <code>0xfff0000000000000L</code>, the <code>double</code> value will be  negative infinity.<li>If bits is in the range <code>0x7ff0000000000001L</code> through <code>0x7fffffffffffffffL</code> or in the range <code>0xfff0000000000001L</code> through <code>0xffffffffffffffffL</code>, the <code>double</code> value will be NaN.<li>In all other cases, let <code>s</code>, <code>e</code>, and <code>m</code> be three values that might be computed from bits:</ul><pre>&nbsp;&nbsp;&nbsp;&nbsp;<code>	int s = ((</code>bits<code> &gt;&gt; 63) == 0) ? 1 : -1;</code>&nbsp;&nbsp;&nbsp;&nbsp;<code>	int e = (int)((</code>bits<code> &gt;&gt; 52) &amp; 0x7ffL);</code>&nbsp;&nbsp;&nbsp;&nbsp;<code>	long m = (e == 0) ?</code>&nbsp;&nbsp;&nbsp;&nbsp;<code>		(</code>bits<code> &amp; 0xfffffffffffffL) &lt;&lt; 1 :</code>&nbsp;&nbsp;&nbsp;&nbsp;<code>		(</code>bits<code> &amp; 0xfffffffffffffL) | 0x10000000000000L;</code></code><ul>Then the floating-point value equals the <code>double</code> value of the mathematical expression <code>s&#183;m&#183;2<sup>e-1075</sup>.</ul></pre><a name="1327"></a></dl><h3>4.4.6    The <code>CONSTANT_NameAndType_info</code> Structure </h3><a name="5970"></a>The <code>CONSTANT_NameAndType_info</code> structure is used to represent a field or method, without indicating which class or interface type it belongs to:<p><pre><br><a name="1328"></a>&nbsp;&nbsp;&nbsp;&nbsp;<code>CONSTANT_NameAndType_info {</code>&nbsp;&nbsp;&nbsp;&nbsp;<code>	u1 tag;</code>&nbsp;&nbsp;&nbsp;&nbsp;<code>	u2 name_index;</code>&nbsp;&nbsp;&nbsp;&nbsp;<code>	u2 descriptor_index;</code><a name="1332"></a>&nbsp;&nbsp;&nbsp;&nbsp;<code>}</code><br></pre><a name="9390"></a>The items of the <code>CONSTANT_NameAndType_info</code> structure are as follows:<p><a name="1334"></a><dl><dt><code>tag</code><dd> The <code>tag</code> item of the <code>CONSTANT_NameAndType_info</code> structure has the value <code>CONSTANT_NameAndType</code> (<code>12</code>).<p><a name="1336"></a><dt><code>name_index</code><dd> The value of the <code>name_index</code> item must be a valid index into the <code>constant_pool</code> table. The <code>constant_pool</code> entry at that index must be a <code>CONSTANT_Utf8_info</code> <a href="ClassFile.doc.html#7963">(&#167;4.4.7)</a> structure representing either a valid field or method name <a href="Concepts.doc.html#21272">(&#167;2.7)</a> stored as a simple name <a href="Concepts.doc.html#21410">(&#167;2.7.1)</a>, that is, as a Java programming language identifier <a href="Concepts.doc.html#25339">(&#167;2.2)</a> or as the special method name <code>&lt;init&gt;</code> <a href="Overview.doc.html#12174">(&#167;3.9)</a>.<p><a name="1338"></a><dt><code>descriptor_index</code><dd> The value of the <code>descriptor_index</code> item must be a valid index into the <code>constant_pool</code> table. The <code>constant_pool</code> entry at that index must be a <code>CONSTANT_Utf8_info</code> <a href="ClassFile.doc.html#7963">(&#167;4.4.7)</a> structure representing a valid field descriptor <a href="ClassFile.doc.html#14152">(&#167;4.3.2)</a> or method descriptor <a href="ClassFile.doc.html#7035">(&#167;4.3.3)</a>.<p><a name="7963"></a></dl><h3>4.4.7    The <code>CONSTANT_Utf8_info</code> Structure</h3><a name="1297"></a>The <code>CONSTANT_Utf8_info</code> structure is used to represent constant string values.<p><a name="3310"></a>UTF-8 strings are encoded so that character sequences that contain only non-null ASCII characters can be represented using only 1 byte per character, but characters of up to 16 bits can be represented. All characters in the range <code>'\u0001'</code> to <code>'\u007F'</code> are represented by a single byte:<p><Table Border="1"><tr> <td><a name="17391"></a> 0<td><a name="17393"></a> bits 6-0</Table><br><p><a name="35791"></a>The 7 bits of data in the byte give the value of the character represented. The null character (<code>'\u0000'</code>) and characters in the range <code>'\u0080'</code> to <code>'\u07FF'</code> are representedby a pair of bytes x and y:<p><Table Border="1"><a name="28487"></a> x: <tr><td><a name="28489"></a> 1<td><a name="28491"></a> 1<td><a name="28493"></a> 0<td><a name="28495"></a> bits 10-6</Table><br><Table Border="1"><a name="28497"></a> y:<tr><td><a name="28499"></a> 1<td><a name="28501"></a> 0<td><a name="28503"></a> bits 5-0</Table><br><p><a name="35796"></a>The bytes represent the character with the value ((x & <code>0x1f</code>) << <code>6</code>) + (y & <code>0x3f</code>).<p><a name="35797"></a>Characters in the range <code>'\u0800'</code> to <code>'\uFFFF'</code> are represented by 3 bytes x, y, and z:<p><Table Border="1"><a name="35800"></a> x:<tr><td><a name="35802"></a> 1<td><a name="35804"></a> 1<td><a name="35806"></a> 1<td><a name="35808"></a> 0<td><a name="35810"></a> bits 15-12</Table><br><Table Border="1"><a name="35812"></a> y:<tr><td><a name="35814"></a> 1<td><a name="35816"></a> 0<td><a name="35818"></a> bits 11-6</Table><br><Table Border="1"><a name="35820"></a> z:<tr><td><a name="35822"></a> 1<td><a name="35824"></a> 0<td><a name="35826"></a> bits 5-0</Table><br><p><a name="15576"></a>The character with the value ((x & <code>0xf</code>) << <code>12</code>) + ((y & <code>0x3f</code>) << <code>6</code>) + (z & <code>0x3f</code>) is represented by the bytes.<p><a name="12887"></a>The bytes of multibyte characters are stored in the <code>class</code> file in big-endian (high byte first) order.<p><a name="6111"></a>There are two differences between this format and the "standard" UTF-8 format. First, the null byte <code>(byte)0</code> is encoded using the 2-byte format rather than the 1-byte format, so that Java virtual machine UTF-8 strings never have embedded nulls. Second, only the 1-byte, 2-byte, and 3-byte formats are used. The Java virtual machine does not recognize the longer UTF-8 formats.<p><a name="14071"></a>For more information regarding the UTF-8 format, see <i>File System Safe UCS Transformation Format (FSS_UTF)</i>, X/Open Preliminary Specification (X/Open Company Ltd., Document Number: P316). This information also appears in ISO/IEC 10646, Annex P.<p><a name="7715"></a>The <code>CONSTANT_Utf8_info</code> structure is<p><pre><br><a name="1298"></a>&nbsp;&nbsp;&nbsp;&nbsp;<code>CONSTANT_Utf8_info {</code>&nbsp;&nbsp;&nbsp;&nbsp;<code>	u1 tag;</code>&nbsp;&nbsp;&nbsp;&nbsp;<code>	u2 length;</code>&nbsp;&nbsp;&nbsp;&nbsp;<code>	u1 bytes[length];</code><a name="9399"></a>&nbsp;&nbsp;&nbsp;&nbsp;<code>}</code><br></pre><a name="9402"></a>The items of the <code>CONSTANT_Utf8_info</code> structure are the following:<p><a name="9401"></a><dl><dt><code>tag</code><dd> The <code>tag</code> item of the <code>CONSTANT_Utf8_info</code> structure has the value <code>CONSTANT_Utf8</code> (<code>1</code>).<p><a name="1312"></a><dt><code>length</code><dd> The value of the <code>length</code> item gives the number of bytes in the <code>bytes</code> array (not the length of the resulting string). The strings in the <code>CONSTANT_Utf8_info</code> structure are not null-terminated.<p><a name="2874"></a><dt><code>bytes[]</code><dd> The <code>bytes</code> array contains the bytes of the string. No byte may have the value <code>(byte)0</code> or lie in the range <code>(byte)0xf0</code>-<code>(byte)0xff</code>.<p><a name="2877"></a></dl><hr><h2>4.5    Fields</h2><a name="1480"></a>Each field is described by a <code>field_info</code> structure. No two fields in one <code>class</code> file may have the same name and descriptor <a href="ClassFile.doc.html#14152">(&#167;4.3.2)</a>. The format of this structure is<p><pre><br><a name="1481"></a>&nbsp;&nbsp;&nbsp;&nbsp;<code>field_info {</code>&nbsp;&nbsp;&nbsp;&nbsp;<code>	u2 access_flags;</code>&nbsp;&nbsp;&nbsp;&nbsp;<code>	u2 name_index;</code>&nbsp;&nbsp;&nbsp;&nbsp;<code>	u2 descriptor_index;</code>&nbsp;&nbsp;&nbsp;&nbsp;<code>	u2 attributes_count;</code>&nbsp;&nbsp;&nbsp;&nbsp;<code>	attribute_info attributes[attributes_count];</code><a name="87646"></a>&nbsp;&nbsp;&nbsp;&nbsp;<code>}</code><br></pre><a name="87647"></a>The items of the <code>field_info</code> structure are as follows:<p><a name="87652"></a><dl><dt><code>access_flags</code>&#32;&#32;<dd> The value of the <code>access_flags</code> item is a mask of flags used to denote access permission to and properties of this field. The interpretation of each flag, when set, is as shown in <a href="ClassFile.doc.html#88358">Table 4.4</a>.<p>Fields of classes may set any of the flags in <a href="ClassFile.doc.html#88358">Table 4.4</a>. However, a specific field of a class may have at most one of its <code>ACC_PRIVATE</code>, <code>ACC_PROTECTED</code>, and <code>ACC_PUBLIC</code> flags set <a href="Concepts.doc.html#18914">(&#167;2.7.4)</a> and may not have both its <code>ACC_FINAL</code> and <code>ACC_VOLATILE</code> flags set <a href="Concepts.doc.html#29882">(&#167;2.9.1)</a>.    <dd><p><Table Border="1"><tr><td><a name="88358"></a><strong>Flag Name</strong><td><a name="88360"></a><strong>Value</strong><td><a name="88362"></a><strong>Interpretation</strong><tr><td><a name="88365"></a><code>ACC_PUBLIC</code>

⌨️ 快捷键说明

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