rjvm 0.3.0

Parse JVM class files with Rust
Documentation
  • Coverage
  • 19.32%
    166 out of 859 items documented0 out of 182 items with examples
  • Size
  • Source code size: 161.07 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 18.16 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • adiepenbrock/rjvm
    0 0 3
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • adiepenbrock

rjvm

rjvm is a Rust crate that enables parsing of JVM class files. This crate supports Java at least up to Java SE 21. The scope of this crate is not to create a JVM, but to parse and write (in the future) JVM class files.

Getting Started

To integrate rjvm into you project, simply add it as a dependency to your Cargo.toml file:

[dependencies]
rjvm = "0.1.0"

To parse a class file, follow these steps:

  • Read the class file into a byte array
  • Create a BufferedReader from the byte array
  • Initialize a mutable ConstantPool to store the constant pool entries
  • Parse the ClassFile using the ClassFile::decode method.
let file = include_bytes!("../path/to/your/class/file.class");
let mut buffer = rjvm::decoder::BufferedReader::new(file);
let mut constant_pool = rjvm::types::constants::ConstantPool::new();
let class_file = rjvm::types::elements::ClassFile::decode(&mut buffer, &mut constant_pool);

Examples

Find some simple examples on how to use rjvm in the examples directory of this repository.

  • decoding.rs: shows an example of how to parse a class file.
  • instructions.rs: shows an example of how to parse a class file and print all methods with their instructions.

Roadmap

  • Parse class files with all related elements
  • Manage constant pools
  • Read JAR files
  • Write class files