繼續分析Class文件的結構
上次讀取了constant pool
private static short ACC_PUBLIC =
private static short ACC_FINAL =
private static short ACC_SUPER =
private static short ACC_INTERFACE =
private static short ACC_ABSTRACT =
// read access flags:
short access_flags = input
System
if((access_flags & ACC_PUBLIC) == ACC_PUBLIC)
System
if((access_flags & ACC_FINAL) == ACC_FINAL)
System
if((access_flags & ACC_SUPER) == ACC_SUPER)
System
if((access_flags & ACC_INTERFACE) == ACC_INTERFACE)
System
if((access_flags & ACC_ABSTRACT) == ACC_ABSTRACT)
System
System
然後是this class和super class
// read this class and super class:
short this_class_index = input
short super_class_index = input
System
System
根據this class的index可以從constant pool中得到這個class的信息
接下來是這個class繼承了多少個interface和每個interface在constant pool中的index
// read interfaces count:
short interfaces_count = input
System
// read each interface:
for(int i=
short interface_index = input
System
}
結果如下
Access flags: public final super
This class =
Super class =
Interfaces count =
From:http://tw.wingwit.com/Article/program/Java/Javascript/201311/25408.html