pub struct ArchiveReader<R> { /* private fields */ }Expand description
A random-access ZArchive reader.
Implementations§
Source§impl ArchiveReader<File>
impl ArchiveReader<File>
Source§impl<R: Read + Seek> ArchiveReader<R>
impl<R: Read + Seek> ArchiveReader<R>
Sourcepub fn lookup(&self, path: impl AsRef<[u8]>) -> Option<NodeHandle>
pub fn lookup(&self, path: impl AsRef<[u8]>) -> Option<NodeHandle>
Returns the node at path, using ASCII case-insensitive matching.
Sourcepub fn lookup_kind(
&self,
path: impl AsRef<[u8]>,
expected: Option<EntryKind>,
) -> Option<NodeHandle>
pub fn lookup_kind( &self, path: impl AsRef<[u8]>, expected: Option<EntryKind>, ) -> Option<NodeHandle>
Returns the node at path only if it has the requested kind.
Sourcepub fn archive_size(&self) -> u64
pub fn archive_size(&self) -> u64
The total size of the archive file, including its tables and footer.
Sourcepub fn compressed_data_size(&self) -> u64
pub fn compressed_data_size(&self) -> u64
The size of the compressed data section, excluding the tables and footer.
pub fn entry_kind(&self, handle: NodeHandle) -> Option<EntryKind>
pub fn directory_len(&self, handle: NodeHandle) -> Result<u32>
pub fn directory_entry( &self, handle: NodeHandle, index: u32, ) -> Result<DirEntry<'_>>
pub fn directory_entries(&self, handle: NodeHandle) -> Result<Vec<DirEntry<'_>>>
pub fn file_size(&self, handle: NodeHandle) -> Result<u64>
Sourcepub fn read_file(
&mut self,
handle: NodeHandle,
offset: u64,
buffer: &mut [u8],
) -> Result<usize>
pub fn read_file( &mut self, handle: NodeHandle, offset: u64, buffer: &mut [u8], ) -> Result<usize>
Reads at most buffer.len() bytes beginning at an offset within a file.
Sourcepub fn read_file_to_end(&mut self, handle: NodeHandle) -> Result<Vec<u8>>
pub fn read_file_to_end(&mut self, handle: NodeHandle) -> Result<Vec<u8>>
Reads an entire archived file into memory.
Sourcepub fn verify_integrity(&mut self) -> Result<bool>
pub fn verify_integrity(&mut self) -> Result<bool>
Verifies the SHA-256 digest stored in the archive footer.
Sourcepub fn verify_integrity_with(
&mut self,
progress: impl FnMut(u64),
) -> Result<bool>
pub fn verify_integrity_with( &mut self, progress: impl FnMut(u64), ) -> Result<bool>
Verifies the footer digest, reporting bytes hashed as it goes.
progress is called with the size of each chunk as it is consumed, so
callers can drive a progress indicator over what is otherwise a single
long pass across the whole file.
pub fn into_inner(self) -> R
Auto Trait Implementations§
impl<R> Freeze for ArchiveReader<R>where
R: Freeze,
impl<R> RefUnwindSafe for ArchiveReader<R>where
R: RefUnwindSafe,
impl<R> Send for ArchiveReader<R>where
R: Send,
impl<R> Sync for ArchiveReader<R>where
R: Sync,
impl<R> Unpin for ArchiveReader<R>where
R: Unpin,
impl<R> UnsafeUnpin for ArchiveReader<R>where
R: UnsafeUnpin,
impl<R> UnwindSafe for ArchiveReader<R>where
R: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more