Struct flate2::write::DeflateEncoder
[−]
[src]
pub struct DeflateEncoder<W: Write> { // some fields omitted }
A DEFLATE encoder, or compressor.
This structure implements a Write
interface and takes a stream of
uncompressed data, writing the compressed data to the wrapped writer.
Methods
impl<W: Write> EncoderWriter<W>
[src]
fn new(w: W, level: Compression) -> EncoderWriter<W>
Creates a new encoder which will write compressed data to the stream given at the given compression level.
When this encoder 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 encoder entirely, swapping out the output stream for another.
This function will finish encoding the current stream into the current output stream before swapping out the two output streams. If the stream cannot be finished an error is returned.
After the current stream has been finished, this will reset the internal
state of this encoder and replace the output stream with the one
provided, returning the previous output stream. Future data written to
this encoder will be the compressed into the stream w
provided.
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.
Trait Implementations
impl<W: Write> Write for EncoderWriter<W>
[src]
fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this object, returning how many bytes were written. Read more
fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
1.0.0
Attempts to write an entire buffer into this write. Read more
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
1.0.0
Writes a formatted string into this writer, returning any error encountered. Read more
fn by_ref(&mut self) -> &mut Self
1.0.0
Creates a "by reference" adaptor for this instance of Write
. Read more