您的当前位置:首页method方法

method方法

来源:锐游网

class文件中的method的数据结构
       名称                              类型                   数量
1.    access_flags                       2B                     1
2.    name_index                         2B                     1
3.    descriptor_index                   2B                     1 
4.    attributes_count                   2B                     1
5.    attributes[attributes_count]       attribute_info         1 

method_info中的attribute_info 的数据结构:
     名称                           类型                   数量
1.   attribute_name_index            2B                     1
2.   attribute_length                4B                     1
3.   max_stack                       2B                     1 
4.   max_locals                      2B                     1
5.   code_length                     4B                     1
6.   code                            1B                     code_length
7.   exception_table_length          2B                     1
8.   exception_table                 exception_info         exception_table_length
9.   attribute_count                 2B                     1
10.  attributes                      attribute_info         attribute_count

(10) attribute_info的数据结构                 类型          数量
1.   attribute_name_index LineNumberTable     2B             1
2.   attribute_length                         4B             1
3.   line_number_table_length                 2B             1
4.   line_number_table_info                   2B             line_number_table_length

(104)line_number_table_info的数据结构
1.   start_pc                                 2B             1
2.   line_number                              2B             1


(30) exception_info的数据结构                 类型           数量
1.   start_pc                                 2B              1
2.   end_pc                                   2B              1
3.   handler_pc                               2B              1
4.   catch_type                               2B              1

(60)code
 javap -c ClassFileName  然后与指令集对照

因篇幅问题不能全部显示,请点此查看更多更全内容

Top