Struct flate2::read::ZlibDecoder [] [src]

pub struct ZlibDecoder<R: Read> {
    // some fields omitted
}

A ZLIB decoder, or decompressor.

This structure implements a Read interface and takes a stream of compressed data as input, providing the decompressed data when read from.

Methods

impl<R: Read> DecoderReader<R>

fn new(r: R) -> DecoderReader<R>

Creates a new decoder which will decompress data read from the given stream.

fn new_with_buf(r: R, buf: Vec<u8>) -> DecoderReader<R>

Same as new, but the intermediate buffer for data is specified.

Note that the specified buffer will only be used up to its current length. The buffer's capacity will also not grow over time.

fn reset(&mut self, r: R) -> R

Resets the state of this decoder entirely, swapping out the input stream for another.

This will reset the internal state of this decoder and replace the input stream with the one provided, returning the previous input stream. Future data read from this decoder will be the decompressed version of r's data.

fn into_inner(self) -> R

Consumes this decoder, returning the underlying reader.

fn total_in(&self) -> u64

Returns the number of bytes that the decompressor has consumed.

Note that this will likely be smaller than what the decompressor actually read from the underlying stream due to buffering.

fn total_out(&self) -> u64

Returns the number of bytes that the decompressor has produced.

Trait Implementations

impl<R: Read> Read for DecoderReader<R>

fn read(&mut self, into: &mut [u8]) -> Result<usize>

1.0.0fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>

1.0.0fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>

1.6.0fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>

1.0.0fn by_ref(&mut self) -> &mut Self

1.0.0fn bytes(self) -> Bytes<Self>

fn chars(self) -> Chars<Self>

1.0.0fn chain<R>(self, next: R) -> Chain<Self, R> where R: Read

1.0.0fn take(self, limit: u64) -> Take<Self>