• Home
  • Raw
  • Download

Lines Matching +full:write +full:- +full:output

9 /// This structure implements a [`Write`] interface and takes a stream of
12 /// [`Write`]: https://doc.rust-lang.org/std/io/trait.Write.html
19 /// use flate2::write::DeflateEncoder;
21 /// // Vec<u8> implements Write to print the compressed bytes of sample string
30 pub struct DeflateEncoder<W: Write> {
34 impl<W: Write> DeflateEncoder<W> {
35 /// Creates a new encoder which will write compressed data to the stream
40 pub fn new(w: W, level: crate::Compression) -> DeflateEncoder<W> { in new()
47 pub fn get_ref(&self) -> &W { in get_ref()
53 /// Note that mutating the output/input state of the stream may corrupt this
55 pub fn get_mut(&mut self) -> &mut W { in get_mut()
59 /// Resets the state of this encoder entirely, swapping out the output
63 /// output stream before swapping out the two output streams. If the stream
67 /// state of this encoder and replace the output stream with the one
68 /// provided, returning the previous output stream. Future data written to
75 pub fn reset(&mut self, w: W) -> io::Result<W> { in reset()
81 /// Attempt to finish this output stream, writing out final chunks of data.
84 /// written to the output stream. After this function is called then further
85 /// calls to `write` may result in a panic.
89 /// Attempts to write data to this stream may result in a panic after this
96 pub fn try_finish(&mut self) -> io::Result<()> { in try_finish()
100 /// Consumes this encoder, flushing the output stream.
108 /// re-acquire ownership of a stream it is safe to call this method after
115 pub fn finish(mut self) -> io::Result<W> { in finish()
120 /// Consumes this encoder, flushing the output stream.
132 pub fn flush_finish(mut self) -> io::Result<W> { in flush_finish()
141 pub fn total_in(&self) -> u64 { in total_in()
149 pub fn total_out(&self) -> u64 { in total_out()
154 impl<W: Write> Write for DeflateEncoder<W> {
155 fn write(&mut self, buf: &[u8]) -> io::Result<usize> { in write() method
156 self.inner.write(buf) in write()
159 fn flush(&mut self) -> io::Result<()> { in flush()
164 impl<W: Read + Write> Read for DeflateEncoder<W> {
165 fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { in read()
172 /// This structure implements a [`Write`] and will emit a stream of decompressed
175 /// [`Write`]: https://doc.rust-lang.org/std/io/trait.Read.html
183 /// # use flate2::write::DeflateEncoder;
184 /// use flate2::write::DeflateDecoder;
193 /// // Here Vec<u8> implements Write
194 /// fn decode_writer(bytes: Vec<u8>) -> io::Result<String> {
204 pub struct DeflateDecoder<W: Write> {
208 impl<W: Write> DeflateDecoder<W> {
209 /// Creates a new decoder which will write uncompressed data to the stream.
213 pub fn new(w: W) -> DeflateDecoder<W> { in new()
220 pub fn get_ref(&self) -> &W { in get_ref()
226 /// Note that mutating the output/input state of the stream may corrupt this
228 pub fn get_mut(&mut self) -> &mut W { in get_mut()
232 /// Resets the state of this decoder entirely, swapping out the output
236 /// output stream before swapping out the two output streams.
239 /// output stream with the one provided, returning the previous output
241 /// the output stream `w`.
247 pub fn reset(&mut self, w: W) -> io::Result<W> { in reset()
253 /// Attempt to finish this output stream, writing out final chunks of data.
256 /// written to the output stream. After this function is called then further
257 /// calls to `write` may result in a panic.
261 /// Attempts to write data to this stream may result in a panic after this
268 pub fn try_finish(&mut self) -> io::Result<()> { in try_finish()
272 /// Consumes this encoder, flushing the output stream.
280 /// re-acquire ownership of a stream it is safe to call this method after
287 pub fn finish(mut self) -> io::Result<W> { in finish()
297 pub fn total_in(&self) -> u64 { in total_in()
302 /// output stream.
303 pub fn total_out(&self) -> u64 { in total_out()
308 impl<W: Write> Write for DeflateDecoder<W> {
309 fn write(&mut self, buf: &[u8]) -> io::Result<usize> { in write() method
310 self.inner.write(buf) in write()
313 fn flush(&mut self) -> io::Result<()> { in flush()
318 impl<W: Read + Write> Read for DeflateDecoder<W> {
319 fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { in read()