Expand description
Java class file format parser.
Parses .class files according to the JVM Specification (JVMS Chapter 4).
Supports all 17 constant pool entry types, access flags, fields, methods,
and 20+ specialized attributes including Code, StackMapTable, BootstrapMethods,
annotations, and more.
§Example
use java_class_rs::parse_classfile;
fn main() {
let data = std::fs::read("MyClass.class").unwrap();
let (_, class_file) = parse_classfile(&data).unwrap();
println!("Class: {:?}", class_file.this_class_name());
}Modules§
Structs§
- Annotation
- Attribute
Info - Generic attribute info. Specialized attributes are parsed separately.
- Bootstrap
Method Entry - Bootstrap
Methods Attribute - Class
Access Flags - Class
File - Parsed Java class file.
- Class
Info - Code
Attribute - Constant
Value Attribute - Double
Info - Dynamic
Info - Exception
Table Entry - Exceptions
Attribute - Field
Access Flags - Field
Info - Fieldref
Info - Float
Info - Inner
Class - Inner
Classes Attribute - Integer
Info - Interface
Methodref Info - Invoke
Dynamic Info - Line
Number Entry - Line
Number Table Attribute - Local
VarTarget Entry - Local
Variable Entry - Local
Variable Table Attribute - Local
Variable Type Entry - Local
Variable Type Table Attribute - Long
Info - Method
Access Flags - Method
Handle Info - Method
Info - Method
Type Info - Methodref
Info - Module
Info - Name
AndType Info - Nest
Host Attribute - Nest
Members Attribute - Package
Info - Parameter
Annotation - Permitted
Subclasses Attribute - Record
Attribute - Record
Component Info - Runtime
Annotations Attribute - Runtime
Parameter Annotations Attribute - Runtime
Type Annotations Attribute - Source
File Attribute - Stack
MapTable Attribute - String
Info - Type
Annotation - A type annotation (JVMS 4.7.20).
- Type
Path Entry - A step in the type_path of a type annotation.
- Utf8
Info
Enums§
- Constant
Pool Entry - A constant pool entry. Index 0 is unused; entries are 1-indexed. Long and Double entries occupy two slots.
- Element
Value - Parsed
Attribute - Parsed attribute with its specialized form if recognized.
- Stack
MapFrame - Type
Annotation Target - Target type for a type annotation (JVMS 4.7.20).
- Verification
Type Info
Functions§
- get_
entry - Helper to get a constant pool entry by its logical index (1-based, accounting for Long/Double double-slot).
- get_
utf8 - Helper to resolve a UTF8 string from the constant pool by index (1-based). Returns None if the index is out of bounds or not a UTF8 entry.
- parse_
classfile - Parse a Java class file from raw bytes.
- parse_
specialized_ attribute - Try to parse a raw attribute into a specialized attribute type based on the attribute name.