Struct flate2::read::GzDecoder [−][src]
A gzip streaming decoder
This structure exposes a Read
interface that will consume compressed
data from the underlying reader and emit uncompressed data.
Examples
use std::io::prelude::*; use std::io; use flate2::read::GzDecoder; // Uncompresses a Gz Encoded vector of bytes and returns a string or error // Here &[u8] implements Read fn decode_reader(bytes: Vec<u8>) -> io::Result<String> { let mut gz = GzDecoder::new(&bytes[..]); let mut s = String::new(); gz.read_to_string(&mut s)?; Ok(s) }
Methods
impl<R: Read> GzDecoder<R>
[src]
[−]
impl<R: Read> GzDecoder<R>
ⓘImportant traits for GzDecoder<R>pub fn new(r: R) -> GzDecoder<R>
[src]
[−]
ⓘImportant traits for GzDecoder<R>
pub fn new(r: R) -> GzDecoder<R>
Creates a new decoder from the given reader, immediately parsing the gzip header.
impl<R> GzDecoder<R>
[src]
[−]
impl<R> GzDecoder<R>
pub fn header(&self) -> Option<&GzHeader>
[src]
[−]
pub fn header(&self) -> Option<&GzHeader>
Returns the header associated with this stream, if it was valid.
ⓘImportant traits for &'a mut Rpub fn get_ref(&self) -> &R
[src]
[−]
ⓘImportant traits for &'a mut R
pub fn get_ref(&self) -> &R
Acquires a reference to the underlying reader.
ⓘImportant traits for &'a mut Rpub fn get_mut(&mut self) -> &mut R
[src]
[−]
ⓘImportant traits for &'a mut R
pub fn get_mut(&mut self) -> &mut R
Acquires a mutable reference to the underlying stream.
Note that mutation of the stream may result in surprising results if this encoder is continued to be used.
pub fn into_inner(self) -> R
[src]
[−]
pub fn into_inner(self) -> R
Consumes this decoder, returning the underlying reader.
Trait Implementations
impl<R: Debug> Debug for GzDecoder<R>
[src]
[+]
impl<R: Debug> Debug for GzDecoder<R>
impl<R: Read> Read for GzDecoder<R>
[src]
[+]
impl<R: Read> Read for GzDecoder<R>
impl<R: Read + Write> Write for GzDecoder<R>
[src]
[+]
impl<R: Read + Write> Write for GzDecoder<R>