Part III of JAVA byte code file (access identification) The second of JAVA byte code file (constant pool)

A, Access Flags access flag

Access flag information includes the Class file is a class or interface is defined as whether public or abstract, if a class, whether declared as final.

Access flag table

 

 

 

Two, Access Flags analysis

 

 

 Previous by JAVA bytecode The second documents (constant pool) position 6374 in the portion of the analysis found the class file constant pool end

 

 

 Access Flags 2 bytes, so the bytecode file access flag is 00 21,0x0021 is 0x0020 and 0x0001 and set the Access Flags, the results indicate the ACC PUBLIC ACC SUPER merger. Description declaration modifying the class is public and inheritance Object

Three, This Class Name of analysis

After This Class Name Access Flags accounted for two bytes and so is 0003. Index is equal to 3, corresponding to the constant pool # 22, the current class is the name

 Fourth, the Super class Name of analysis

Super class Name accounting for this Class Name it after the two bytes are 00 04. Index is equal to 4, corresponding to the constant pool # 4, is the parent class of the current class

 

 V. Analysis of Interface

Interface 2 + n th byte accounting after the Super class Name, the first two byte is the number of interfaces, n is represented by one byte after the specific interface.

Because Interface num = 00 00; so the class does not implement any interface that is not indexed with constant pool match.

Six, Fields of analysis

Fields ranges : field tables used to describe variables declared in classes and interfaces. This field contains the variable class-level (static variables) and instance variables, but does not include a method of local variables declared inside

Table set of attributes:

Fields 占 Interface 之后的2+n个byte,前两个byte是Fields 的数量,之后的n个byte表示Fields的具体信息。

由于 Fields num= 00 01;所以该类具有一个成员变量。

u2 access_flags :00 02 ,访问标识的是0002,ACC_PRIVATE

u2 name_index: 00 05,名字的索引是5,对应常量池的#5

u2 descriptor_index :00 06,描述符的索引是6,对应常量池的#6 ,所以变量的类型是int

u2 attributes_count:00 00 ,扩展属性为0,所以该变量没有扩展属性,所以就不存在 attribute_info 

attribute_info attributes[attributes_count];

 

 

0x0021:

Guess you like

Origin www.cnblogs.com/jalja365/p/12153494.html