3 Class-File Java Programm in Java Compiler class files Java Programm in anderer Sprache Compiler class files Programm in Java Compiler Other binary format 4 Typen
1. PRIMITIVE TYPEN
u1 ...1 unsigned byte
u2 ... 2 unsigned bytes
u4 ... 4 unsigned bytes
u8 ... 8 unsigned bytes
2. TABELLENNAME
Big Endian 5 Klassendatei - Struktur
ClassFile
u4 magic
u2 minor_version
u2 major_version
u2 constant_pool_count
cp_info constant_pool constant_pool_count-1
u2 access_flags
u2 this_class
u2 super_class
u2 interfaces_count
u2 interfacesinterfaces_count
u2 fields_count
field_info fieldsfields_count
u2 methods_count
method_info methodsmethods_count
u2 attributes_count
attributte_info attributesattributes_count
Magic Number 0xCAFEBABE 6 Beispiele zur Version
JDK 1.0.2 unterstützt Klassendatei- Formate der Versionen 45.0 bis 45.3
SDK 1.2 unterstützt Klassendatei- Formate der Versionen 45.0 bis 46.0
Versionsnummer 45.3 Major version no. Minor version no. 7 Klassendatei - Struktur
ClassFile
u4 magic ?
u2 minor_version ?
u2 major_version ?
u2 constant_pool_count
cp_info constant_pool constant_pool_count-1
u2 access_flags
u2 this_class
u2 super_class
u2 interfaces_count
u2 interfacesinterfaces_count
u2 fields_count
field_info fields fields_count
u2 methods_count
method_info methodsmethods_count
u2 attributes_count
attributte_info attributesattributes_count
8 Constant Pool Tag CONSTANT_Class constant_pool Entry 1 name_index 7 constant_pool Entry 7 Tag CONSTANT_Utf8_info length 3 bytes Act this class This_class 1 9 Klassendatei - Struktur
ClassFile
u4 magic ?
u2 minor_version ?
u2 major_version ?
u2 constant_pool_count ?
cp_info constant_pool constant_pool_count-1 ?
u2 access_flags
u2 this_class
u2 super_class
u2 interfaces_count
u2 interfacesinterfaces_count
u2 fields_count
field_info fieldsfields_count
u2 methods_count
method_info methodsmethods_count
u2 attributes_count
attribute_info attributesattributes_count
10 Access_flags Flag Name Bedeutung Verwendung ACC_PUBLIC Zugriff ausserhalb des Package möglich Klasse, Interface ACC_FINAL Keine Unterklassen erlaubt Klasse ACC_SUPER Hat geerbte Methoden Klasse, Interface ACC_INTERFACE Ist ein Interface Interface ACC_ABSTRACT Ist Abstract und kann nicht instanziert werden Klasse, Interface 11 Überblick
Klassendatei ?
Spezielle Strings
Constant Pool
Attribute
12 Spezielle Strings
Fully qualified Names
Simple Names
Descriptors
13 Fully qualified names
Source Code
java.lang.Thread
Class File
java/lang/Thread
14 Simple names
Constant Pool Eintrag der auf die Methode String toString() verweist
toString
Constant Pool Eintrag der auf das Feld java.io.PrintStram out verweist
out
15 Descriptors FieldDescriptor FieldType ComponentType FieldType FieldType BaseType ObjectType ArrayType BaseType B C D F I J S Z ObjectType Lltclassnamegt ArrayType ComponentType MethodDesciptor ( ParameterDesciptor ) ReturnDesciptor ObjectType ArrayType ParameterDesciptor FieldType ReturnDesciptor FieldType V 16 Beispiele - Field Desciptor
int i ? I
long windingRoad ? J
java.lang.Object stuff ? Ljava/lang/Object
17 Beispiel MethodDescriptor
int getSize
? ()I
void main(String args)
? (Ljava/lang/String)V
boolean regionMatches(boolean ignoreCase, int toOffset, String other, int offset, int len)
PowerShow.com is a leading presentation sharing website. It has millions of presentations already uploaded and available with 1,000s more being uploaded by its users every day. Whatever your area of interest, here you’ll be able to find and view presentations you’ll love and possibly download. And, best of all, it is completely free and easy to use.
You might even have a presentation you’d like to share with others. If so, just upload it to PowerShow.com. We’ll convert it to an HTML5 slideshow that includes all the media types you’ve already added: audio, video, music, pictures, animations and transition effects. Then you can share it with your target audience as well as PowerShow.com’s millions of monthly visitors. And, again, it’s all free.
About the Developers
PowerShow.com is brought to you by CrystalGraphics, the award-winning developer and market-leading publisher of rich-media enhancement products for presentations. Our product offerings include millions of PowerPoint templates, diagrams, animated 3D characters and more.