#class #file-reader #struct #utf-8 #matching #jvm #constant

class-rs

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

4 releases (breaking)

0.4.0 Mar 1, 2025
0.3.0 Jan 16, 2025
0.2.0 Jan 4, 2025
0.1.0 Jan 4, 2025

#935 in Text processing

Download history 202/week @ 2024-12-30 49/week @ 2025-01-06 120/week @ 2025-01-13 15/week @ 2025-01-20 17/week @ 2025-02-03 17/week @ 2025-02-10 2/week @ 2025-02-17 118/week @ 2025-02-24 35/week @ 2025-03-03 3/week @ 2025-03-10

163 downloads per month

MIT/Apache

130KB
3.5K 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

~125KB