classreader 0.2.1

A Rust library that reads, writes, and parses Java Virtula Machine class files.
Documentation
  • Coverage
  • 0%
    0 out of 443 items documented0 out of 3 items with examples
  • Size
  • Source code size: 92.41 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 9.79 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 12s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • vcfxb/classreader-rs
    6 2 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • musiKk vcfxb

classreader

Parses the class file format that is used by the Java Virtual Machine version 8.

Synopsis

extern crate classreader;

use classreader::ClassReader;
use std::fs::File;

pub fn main() {
    let mut file = File::open("pkg/Test.class").unwrap();
    let class = ClassReader::new_from_reader(file).unwrap();

    assert_eq!(0xCAFEBABE, class.magic);
}

classreader uses the log crate to emit some log messages. They are mainly useful for low level debugging.

Completeness

Parses the whole rt.jar of OpenJDK 8 without issue. Code is not yet decoded. Apart from that, everything is parsed into suitable data structures.

Issues

Strings from a class file's constant pool are currently parsed into a Rust String. It seems that class files may contain code points for surrogate pairs. These are invalid for UTF-8 encoded strings which is what Rust uses. So whenever such a code point is decoded, it is replaced by the Unicode Replacement Character U+FFFD. This happens rarely but it does happen. A log message with info level is emitted.

License

Apache License Version 2. See LICENSE for the text.