The main structure of the Java bytecode file is divided into several parts:the class file header, the Chang area, the current class description information, the field list, the method list, and the attribute list .
class file Header
The contents of the first four bytes of any class file are CA FE BA be. Java is a kind of coffee, so called coffee baby. This four bytes is used as the checksum for the file. --"4
Next is the version information for the JDK, with two bytes representing the lowest version of the JDK and the highest version of the two-byte jdk. --"4
Constant pool area
Each item in a constant pool consists of two parts: one byte flags his type, then the content, and the content is not the same width. This content first records the position of his real content in another constant pool by two bytes. Called a constant pool entry.
Description information for the class
An access flag for the two-byte flag class. Public Private ... Two bytes flags the position of the class name in the constant pool. Two bytes flag the position of its parent class in the constant pool. The number of interfaces is then marked with two bytes. Next, a constant pool entry for each interface is listed, each of which accounts for two bytes.
Field List
The number of two-byte fields. Next is the individual properties, which all have the same internal structure (attribute name, property type, number of attached properties, attached property).
Method List
The number of two-byte methods. Similarly each method describes the internal structure identically.
Next is the description of the method body, the number of attributes, the length, the stack size, the local variables, the code list (the information that describes the actual code snippet).
Where the code list has its own internal structure: stack, local variable, code length, exception list
Structure parsing of JVM--java bytecode