19 releases (11 breaking)

new 0.12.2 Dec 13, 2024
0.12.0 Nov 29, 2024
0.4.0 Jul 26, 2024

#528 in Development tools

Download history 23/week @ 2024-08-22 17/week @ 2024-09-12 7/week @ 2024-09-19 12/week @ 2024-09-26 6/week @ 2024-10-03 444/week @ 2024-10-10 198/week @ 2024-10-17 31/week @ 2024-10-24 138/week @ 2024-10-31 65/week @ 2024-11-07 177/week @ 2024-11-14 35/week @ 2024-11-21 148/week @ 2024-11-28 146/week @ 2024-12-05

567 downloads per month
Used in 3 crates (2 directly)

Apache-2.0 OR MIT

600KB
15K SLoC

Ristretto ClassFile

ci Documentation Code Coverage Benchmarks Latest version License Semantic Versioning

Getting Started

Implementation of the JVM Class File Format that is used to read, write and verify Java classes.

Supports reading and writing class files for any version of Java version up to 24. Verification of class files is supported, but is still a work in progress.

Examples

use ristretto_classfile::{ClassFile, ConstantPool, Result, Version};

fn main() -> Result<()> {
    let mut constant_pool = ConstantPool::default();
    let this_class = constant_pool.add_class("Foo")?;
    let class_file = ClassFile {
        version: Version::Java21 { minor: 0 },
        constant_pool,
        this_class,
        ..Default::default()
    };
    class_file.verify()
}

Safety

This crate uses #![forbid(unsafe_code)] to ensure everything is implemented in 100% safe Rust.

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

VSCode Development Container
GitHub Codespaces

Dependencies

~1.1–1.8MB
~35K SLoC