jimage_rs/lib.rs
1//! # jimage-rs
2//! A fast and efficient Rust library for working with `jimage` files used by the Java Platform Module System.
3//! ## Example
4//! ```rust
5//! use std::env;
6//! use std::path::PathBuf;
7//! use jimage_rs::JImage;
8//!
9//! fn main() -> Result<(), Box<dyn std::error::Error>> {
10//! let path = PathBuf::from(env::var("JAVA_HOME")?)
11//! .join("lib")
12//! .join("modules");
13//! let jimage = JImage::open(path)?;
14//!
15//! let resource_count = jimage.resource_names_iter().count();
16//! println!("Total resources in jimage: {}", resource_count);
17//!
18//! match jimage.find_resource("/java.base/java/lang/String.class")? {
19//! Some(resource) => println!("Resource found, its size is {} bytes", resource.len()),
20//! None => println!("Resource not found"),
21//! }
22//!
23//! Ok(())
24//! }
25//! ```
26mod bytes_utils;
27pub mod error;
28mod header;
29pub mod jimage;
30pub mod raw_jimage;
31mod resource_header;
32mod resource_name;
33pub use crate::jimage::JImage;
34pub use crate::resource_name::{ResourceName, ResourceNamesIter};