#java-class #parser #format #constant #info #pool #inspect

java_class_parser

provides a way of easily parsing and analyzing java classes

2 releases

0.0.2 Nov 22, 2022
0.0.0 Nov 15, 2022

#27 in #java-class

MIT/Apache

61KB
1.5K SLoC

Java Class Parser

Provides mechanisms to parse class files


lib.rs:

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");

Dependencies

~9MB
~149K SLoC