pub struct Ad1Reader { /* private fields */ }Expand description
A reader over an AD1 logical image (its first segment plus any .ad2…).
Implementations§
Source§impl Ad1Reader
impl Ad1Reader
Sourcepub fn open(first_segment: &Path) -> Result<Self, Ad1Error>
pub fn open(first_segment: &Path) -> Result<Self, Ad1Error>
Open an AD1 image given the path to its first segment (*.ad1);
subsequent segments are discovered alongside it.
§Errors
Ad1Error::NotAd1if the signature is absent (the bytes are shown),Ad1Error::UnsupportedforADCRYPT(encrypted) images,Ad1Error::Malformed/Ad1Error::Iofor structural / I/O faults.
Sourcepub fn entries(&self) -> &[Ad1Entry]
pub fn entries(&self) -> &[Ad1Entry]
The logical file tree (depth-first, directories before their children).
Sourcepub fn image_version(&self) -> u32
pub fn image_version(&self) -> u32
AD1 format version recorded in the logical header (commonly 3 or 4).
Sourcepub fn chunk_size(&self) -> u32
pub fn chunk_size(&self) -> u32
Maximum decompressed bytes per zlib data chunk.
Sourcepub fn segment_count(&self) -> u32
pub fn segment_count(&self) -> u32
Number of segments declared by the image header.
Sourcepub fn missing_segments(&self) -> Vec<u32>
pub fn missing_segments(&self) -> Vec<u32>
1-based indices of segments the header declares but that are absent on
disk (feeds the AD1-SEGMENT-MISSING audit). Empty for a complete image.
Sourcepub fn read_at(
&self,
entry: &Ad1Entry,
offset: u64,
buf: &mut [u8],
) -> Result<usize, Ad1Error>
pub fn read_at( &self, entry: &Ad1Entry, offset: u64, buf: &mut [u8], ) -> Result<usize, Ad1Error>
Read up to buf.len() decompressed bytes of entry starting at
offset, inflating only the zlib chunks the range overlaps.
Returns the number of bytes written (0 at or past end of file, or for a directory).
§Errors
Ad1Error::Malformed / Ad1Error::Io on a corrupt chunk table or
decompression failure.