pub struct File<'a, R> { /* private fields */ }Expand description
A file in a ZIP archive.
Implementations§
Source§impl<'a, R: BufRead + Seek> File<'a, R>
impl<'a, R: BufRead + Seek> File<'a, R>
Sourcepub fn metadata(&self) -> &'a Metadata
pub fn metadata(&self) -> &'a Metadata
Gets the metadata of the file.
The lifetime of the returned reference is bound to the Archive, so it
can outlive self.
Sourcepub fn read(&mut self) -> Result<impl Read + '_>
pub fn read(&mut self) -> Result<impl Read + '_>
Returns a reader with the content of the file.
Unsupported compression methods will return an error.
Sourcepub fn read_stored(self) -> Result<Take<&'a mut R>>
pub fn read_stored(self) -> Result<Take<&'a mut R>>
Returns a reader with the content of the file.
Errors if the file is compressed, encrypted or corrupted. Is is not
necessary to use Metadata::content_checker on the result.
It is useful if you know that the file is stored as-is and you want to
take advantage of the BufReader or the Seek implementation.
Sourcepub fn read_raw(&mut self) -> Result<Take<&mut R>>
pub fn read_raw(&mut self) -> Result<Take<&mut R>>
Returns a reader with the raw, compressed, content of the file.
The uncompressed content should be checked with Metadata::content_checker.
Sourcepub fn into_reader(self) -> &'a mut R
pub fn into_reader(self) -> &'a mut R
Consumes self, returning the underlying reader.
This reader can be used with Metadata::read_raw to read the raw,
compressed content of the file. The uncompressed content should then be
checked with Metadata::content_checker.