Struct rc_zip::reader::ArchiveReader
source · pub struct ArchiveReader { /* private fields */ }
Expand description
ArchiveReader parses a valid zip archive into an Archive. In particular, this struct finds an end of central directory record, parses the entire central directory, detects text encoding, and normalizes metadata.
Implementations§
source§impl ArchiveReader
impl ArchiveReader
sourcepub fn new(size: u64) -> Self
pub fn new(size: u64) -> Self
Create a new archive reader with a specified file size.
Actual reading of the file is performed by calling wants_read(), read() and process() in a loop.
sourcepub fn wants_read(&self) -> Option<u64>
pub fn wants_read(&self) -> Option<u64>
sourcepub fn read(&mut self, rd: &mut dyn Read) -> Result<usize, Error>
pub fn read(&mut self, rd: &mut dyn Read) -> Result<usize, Error>
Reads some data from rd
into the reader’s internal buffer.
Any I/O errors will be returned.
If successful, this returns the number of bytes read. On success, process() should be called next.
sourcepub fn process(&mut self) -> Result<ArchiveReaderResult, Error>
pub fn process(&mut self) -> Result<ArchiveReaderResult, Error>
Process buffered data
Errors returned from process() are caused by invalid zip archives, unsupported format quirks, or implementation bugs - never I/O errors.
A result of ArchiveReaderResult::Continue indicates one should loop again, starting with wants_read().
A result of ArchiveReaderResult::Done contains the Archive, and indicates that no method should ever be called again on this reader.