#java-class #parser #file #class-parser

classfmt

A library for parsing Java class files

8 releases (4 breaking)

0.5.1 May 18, 2021
0.5.0 May 18, 2021
0.4.1 May 18, 2021
0.3.1 May 17, 2021
0.1.0 Feb 25, 2021

#20 in #java-class

30 downloads per month

Apache-2.0

57KB
1.5K SLoC

classfmt

(This is not even remotely production-ready)

A library for parsing Java class files.

use std::{fs::File, io, io::Read, path::Path};

use classfmt::ClassParser;

fn main() -> io::Result<()> {
    let mut f = File::open(Path::new("./tests/Fields.class"))?;
    let mut buf = Vec::with_capacity(64);
    f.read_to_end(&mut buf)?;

    let class = ClassParser::from_bytes(&buf).parse().unwrap();

    println!("{:#?}", class);
    Ok(())
}

Dependencies

~89KB