Struct flate2::write::ZlibDecoder [] [src]

pub struct ZlibDecoder<W: Write> {
    // some fields omitted
}

A ZLIB decoder, or decompressor.

This structure implements a Write and will emit a stream of decompressed data when fed a stream of compressed data.

Methods

impl<W: Write> DecoderWriter<W>

fn new(w: W) -> DecoderWriter<W>

Creates a new decoder which will write uncompressed data to the stream.

When this decoder is dropped or unwrapped the final pieces of data will be flushed.

fn reset(&mut self, w: W) -> Result<W>

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

This will reset the internal state of this decoder and replace the output stream with the one provided, returning the previous output stream. Future data written to this decoder will be decompressed into the output stream w.

fn finish(self) -> Result<W>

Consumes this encoder, flushing the output stream.

This will flush the underlying data stream and then return the contained writer if the flush succeeded.

fn total_in(&self) -> u64

Returns the number of bytes that the decompressor has consumed for decompression.

Note that this will likely be smaller than the number of bytes successfully written to this stream due to internal buffering.

fn total_out(&self) -> u64

Returns the number of bytes that the decompressor has written to its output stream.

Trait Implementations

impl<W: Write> Write for DecoderWriter<W>

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

fn flush(&mut self) -> Result<()>

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

1.0.0fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>

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