diff --git a/src/deflate/bufread.rs b/src/deflate/bufread.rs index 65358374..d2f2a93e 100644 --- a/src/deflate/bufread.rs +++ b/src/deflate/bufread.rs @@ -127,6 +127,11 @@ impl Write for DeflateEncoder { /// This structure implements a [`Read`] interface. When read from, it reads /// compressed data from the underlying [`BufRead`] and provides the uncompressed data. /// +/// After reading a single member of the DEFLATE data this reader will return +/// Ok(0) even if there are more bytes available in the underlying reader. +/// If you need the following bytes, call `into_inner()` after Ok(0) to +/// recover the underlying reader. +/// /// [`Read`]: https://doc.rust-lang.org/std/io/trait.Read.html /// [`BufRead`]: https://doc.rust-lang.org/std/io/trait.BufRead.html /// diff --git a/src/deflate/read.rs b/src/deflate/read.rs index 2b6b8f2f..8466681c 100644 --- a/src/deflate/read.rs +++ b/src/deflate/read.rs @@ -123,6 +123,12 @@ impl Write for DeflateEncoder { /// This structure implements a [`Read`] interface. When read from, it reads /// compressed data from the underlying [`Read`] and provides the uncompressed data. /// +/// After reading a single member of the DEFLATE data this reader will return +/// Ok(0) even if there are more bytes available in the underlying reader. +/// `DeflateDecoder` may have read additional bytes past the end of the DEFLATE data. +/// If you need the following bytes, wrap the `Reader` in a `std::io::BufReader` +/// and use `bufread::DeflateDecoder` instead. +/// /// [`Read`]: https://doc.rust-lang.org/std/io/trait.Read.html /// /// # Examples diff --git a/src/deflate/write.rs b/src/deflate/write.rs index 0bd8502c..402899a9 100644 --- a/src/deflate/write.rs +++ b/src/deflate/write.rs @@ -172,6 +172,10 @@ impl Read for DeflateEncoder { /// This structure implements a [`Write`] and will emit a stream of decompressed /// data when fed a stream of compressed data. /// +/// After decoding a single member of the DEFLATE data this writer will return the number of bytes up to +/// to the end of the DEFLATE member and subsequent writes will return Ok(0) allowing the caller to +/// handle any data following the DEFLATE member. +/// /// [`Write`]: https://doc.rust-lang.org/std/io/trait.Read.html /// /// # Examples diff --git a/src/zlib/bufread.rs b/src/zlib/bufread.rs index da7ed95e..4c89b1d4 100644 --- a/src/zlib/bufread.rs +++ b/src/zlib/bufread.rs @@ -132,6 +132,11 @@ impl Write for ZlibEncoder { /// This structure implements a [`Read`] interface. When read from, it reads /// compressed data from the underlying [`BufRead`] and provides the uncompressed data. /// +/// After reading a single member of the ZLIB data this reader will return +/// Ok(0) even if there are more bytes available in the underlying reader. +/// If you need the following bytes, call `into_inner()` after Ok(0) to +/// recover the underlying reader. +/// /// [`Read`]: https://doc.rust-lang.org/std/io/trait.Read.html /// [`BufRead`]: https://doc.rust-lang.org/std/io/trait.BufRead.html /// diff --git a/src/zlib/read.rs b/src/zlib/read.rs index 3b41ae6c..b52838fc 100644 --- a/src/zlib/read.rs +++ b/src/zlib/read.rs @@ -129,6 +129,12 @@ impl Write for ZlibEncoder { /// This structure implements a [`Read`] interface. When read from, it reads /// compressed data from the underlying [`Read`] and provides the uncompressed data. /// +/// After reading a single member of the ZLIB data this reader will return +/// Ok(0) even if there are more bytes available in the underlying reader. +/// `ZlibDecoder` may have read additional bytes past the end of the ZLIB data. +/// If you need the following bytes, wrap the `Reader` in a `std::io::BufReader` +/// and use `bufread::ZlibDecoder` instead. +/// /// [`Read`]: https://doc.rust-lang.org/std/io/trait.Read.html /// /// # Examples diff --git a/src/zlib/write.rs b/src/zlib/write.rs index 64c2c872..1d629b3c 100644 --- a/src/zlib/write.rs +++ b/src/zlib/write.rs @@ -180,6 +180,10 @@ impl Read for ZlibEncoder { /// This structure implements a [`Write`] and will emit a stream of decompressed /// data when fed a stream of compressed data. /// +/// After decoding a single member of the ZLIB data this writer will return the number of bytes up to +/// to the end of the ZLIB member and subsequent writes will return Ok(0) allowing the caller to +/// handle any data following the ZLIB member. +/// /// [`Write`]: https://doc.rust-lang.org/std/io/trait.Write.html /// /// # Examples