#class #file #matching #struct #read #constant #1-to-1

class-rs

Reads/writes a .class file into/from an almost 1-to-1 matching struct

3 releases (breaking)

0.3.0 Jan 16, 2025
0.2.0 Jan 4, 2025
0.1.0 Jan 4, 2025

#1230 in Text processing

Download history 247/week @ 2025-01-04 106/week @ 2025-01-11 33/week @ 2025-01-18 17/week @ 2025-02-01

160 downloads per month

MIT/Apache

120KB
3K SLoC

class-rs

Reads a .class file into an almost 1-to-1 matching struct or generates a .class file from said structure.
⚠️ Constant::Utf8 are using Rust's String type and not the JVM's modified UTF-8. If you have a string that makes that crate panic, open an issue.

Example

let mut jvm = JVMClass::new();
let mut file = std::fs::File::open("Test.class").unwrap();
jvm.load(&mut file).unwrap();
let mut fs = std::fs::File::create("Test2.class").unwrap();
jvm.store(&mut fs).unwrap();

lib.rs:

JVM class file reader

Reads a .class file into an almost 1-to-1 matching struct or generates a .class file from said structure.

Dependencies

~115KB