Crate java_class_parser

Source
Expand description

Provides mechanisms to parse and then inspect java class files. Java classes have very specific formats that can be parsed. However, because the format relies on constantly referring back to a constant pool, information can be hard to actually parse. This library provides easier mechanisms for digesting this info.

There are three main entrance points to the api: parse_file, parse_bytes, and JavaClassParser

§Example

If you want to inspect many classes, it may be better to create the parser using a classpath, then finding classes by their fully qualified path.

let mut parser = JavaClassParser::new("classes.jar");
let class1 = parser.find("com.example.TestClass").expect("couldn't find class");
let class2 = parser.find("com.example.OtherTestClass").expect("couldn't find class");

Modules§

attributes
Parsed attributes
error
Contains the error type that can be emitted
inheritance
Provides mechanisms to inspect the inheritance structure of a class

Structs§

FQNameBuf
An owned version of a fully qualified name
Field
A field in a class
JavaClass
A java class
JavaClassParser
Parses java classes from .class files. Produces a JavaClass if successful.
Method
A field in a class

Enums§

Signature
A signature

Traits§

HasAttributes
Objects which implement this trait can be queried for their attributes.

Functions§

parse_bytes
Parse bytes into a java class.
parse_file
Parses the contents of a file into a java class