Crates.io | classfile-parser |
lib.rs | classfile-parser |
version | 0.3.8 |
source | src |
created_at | 2017-06-30 14:40:14.368173 |
updated_at | 2024-10-10 22:55:07.258328 |
description | A parser for Java Class files written in rust |
homepage | |
repository | https://github.com/Palmr/classfile-parser |
max_upload_size | |
id | 21328 |
size | 85,711 |
A parser for Java Classfiles, written in Rust using nom.
Classfile Parser is available from crates.io and can be included in your Cargo enabled project like this:
[dependencies]
classfile-parser = "~0.3"
extern crate classfile_parser;
use classfile_parser::class_parser;
fn main() {
let classfile_bytes = include_bytes!("../path/to/JavaClass.class");
match class_parser(classfile_bytes) {
Ok((_, class_file)) => {
println!(
"version {},{} \
const_pool({}), \
this=const[{}], \
super=const[{}], \
interfaces({}), \
fields({}), \
methods({}), \
attributes({}), \
access({:?})",
class_file.major_version,
class_file.minor_version,
class_file.const_pool_size,
class_file.this_class,
class_file.super_class,
class_file.interfaces_count,
class_file.fields_count,
class_file.methods_count,
class_file.attributes_count,
class_file.access_flags
);
}
Err(_) => panic!("Failed to parse"),
};
}