Struct fdeflate::Decompressor
source · pub struct Decompressor { /* private fields */ }
Expand description
Decompressor for arbitrary zlib streams.
Implementations§
source§impl Decompressor
impl Decompressor
sourcepub fn ignore_adler32(&mut self)
pub fn ignore_adler32(&mut self)
Ignore the checksum at the end of the stream.
sourcepub fn read(
&mut self,
input: &[u8],
output: &mut [u8],
output_position: usize,
end_of_input: bool
) -> Result<(usize, usize), DecompressionError>
pub fn read( &mut self, input: &[u8], output: &mut [u8], output_position: usize, end_of_input: bool ) -> Result<(usize, usize), DecompressionError>
Decompresses a chunk of data.
Returns the number of bytes read from input
and the number of bytes written to output
,
or an error if the deflate stream is not valid. input
is the compressed data. output
is
the buffer to write the decompressed data to, starting at index output_position
.
end_of_input
indicates whether more data may be available in the future.
The contents of output
after output_position
are ignored. However, this function may
write additional data to output
past what is indicated by the return value.
When this function returns Ok
, at least one of the following is true:
- The input is fully consumed.
- The output is full.
- The deflate stream is complete (and
is_done
will return true).
Panics
This function will panic if there is no space in output
beyond index output_position
or
if output_position
is out of bounds.