dis.readInt(); // magic
dis.readUnsignedShort(); // minor_version
dis.readUnsignedShort(); // major_version
JConstantPool constant_pool =
new JConstantPool(dis.readUnsignedShort());
constant_pool.parse(dis);
access_flags = dis.readUnsignedShort();
int this_class_index = dis.readUnsignedShort();
int super_class_index = dis.readUnsignedShort();
int[] interface_indexes = new int[dis.readUnsignedShort()];
for (int i = 0; i < interface_indexes.length; i++) {
interface_indexes[i] = dis.readUnsignedShort();
}
int field_count = dis.readUnsignedShort();
for (int i = 0; i < field_count; i++) {
dis.readUnsignedShort(); // access_flags
dis.readUnsignedShort(); // name_index
dis.readUnsignedShort(); // descriptor_index
int attrib_count = dis.readUnsignedShort();
for (int k = 0; k < attrib_count; k++) {
int index = dis.readUnsignedShort();
JAttribute.create(constant_pool, index).parse(dis);
}
}
methods = new JMethod[dis.readUnsignedShort()];
for (int i = 0; i < methods.length; i++) {
methods[i] = new JMethod(constant_pool);
methods[i].parse(dis);
}
int attribute_count = dis.readUnsignedShort();
for (int i = 0; i < attribute_count; i++) {
int index = dis.readUnsignedShort();
JAttribute.create(constant_pool, index).parse(dis);
}
// resolve
class_name = constant_pool.getConstantClass(
this_class_index).getClassName();
if (super_class_index != 0) {
super_class_name = constant_pool.getConstantClass(
super_class_index).getClassName();
} else {
super_class_name = null;
}
interface_names = new String[interface_indexes.length];
for (int i = 0; i < interface_names.length; i++) {
interface_names[i] = constant_pool.getConstantClass(
interface_indexes[i]).getClassName();
}
}