Struct GzDecoder
struct GzDecoder<R> { ... }
A decoder for a single member of a gzip file.
This structure implements a Read interface. When read from, it reads
compressed data from the underlying Read and provides the uncompressed data.
After reading a single member of the gzip data this reader will return
Ok(0) even if there are more bytes available in the underlying reader.
GzDecoder may have read additional bytes past the end of the gzip data.
If you need the following bytes, wrap the Reader in a std::io::BufReader
and use bufread::GzDecoder instead.
To handle gzip files that may have multiple members, see MultiGzDecoder
or read more
in the introduction.
Examples
use *;
use io;
# use Compression;
# use GzEncoder;
use GzDecoder;
#
#
// Uncompresses a Gz Encoded vector of bytes and returns a string or error
// Here &[u8] implements Read
Implementations
impl<R> GzDecoder<R>
fn header(self: &Self) -> Option<&GzHeader>Returns the header associated with this stream, if it was valid.
fn get_ref(self: &Self) -> &RAcquires a reference to the underlying reader.
Note that the decoder may have read past the end of the gzip data. To prevent this use
bufread::GzDecoderinstead.fn get_mut(self: &mut Self) -> &mut RAcquires a mutable reference to the underlying stream.
Note that mutation of the stream may result in surprising results if this decoder continues to be used.
Note that the decoder may have read past the end of the gzip data. To prevent this use
bufread::GzDecoderinstead.fn into_inner(self: Self) -> RConsumes this decoder, returning the underlying reader.
Note that the decoder may have read past the end of the gzip data. Subsequent reads will skip those bytes. To prevent this use
bufread::GzDecoderinstead.
impl<R: Read> GzDecoder<R>
fn new(r: R) -> GzDecoder<R>Creates a new decoder from the given reader, immediately parsing the gzip header.
impl<R> Freeze for GzDecoder<R>
impl<R> RefUnwindSafe for GzDecoder<R>
impl<R> Send for GzDecoder<R>
impl<R> Sync for GzDecoder<R>
impl<R> Unpin for GzDecoder<R>
impl<R> UnsafeUnpin for GzDecoder<R>
impl<R> UnwindSafe for GzDecoder<R>
impl<R: $crate::fmt::Debug> Debug for GzDecoder<R>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<R: Read + Write> Write for GzDecoder<R>
fn write(self: &mut Self, buf: &[u8]) -> Result<usize>fn flush(self: &mut Self) -> Result<()>
impl<R: Read> Read for GzDecoder<R>
fn read(self: &mut Self, into: &mut [u8]) -> Result<usize>
impl<T> Any for GzDecoder<R>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for GzDecoder<R>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for GzDecoder<R>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> From for GzDecoder<R>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into for GzDecoder<R>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for GzDecoder<R>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for GzDecoder<R>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>