pub struct Decoder<'a, R: BufRead> { /* private fields */ }
Expand description
A decoder that decompress input data from another Read
.
This allows to read a stream of compressed data (good for files or heavy network stream).
Implementations§
Source§impl<R: BufRead> Decoder<'static, R>
impl<R: BufRead> Decoder<'static, R>
Sourcepub fn with_buffer(reader: R) -> Result<Self>
pub fn with_buffer(reader: R) -> Result<Self>
Creates a new decoder around a BufRead
.
Sourcepub fn with_dictionary(reader: R, dictionary: &[u8]) -> Result<Self>
pub fn with_dictionary(reader: R, dictionary: &[u8]) -> Result<Self>
Creates a new decoder, using an existing dictionary.
The dictionary must be the same as the one used during compression.
Source§impl<'a, R: BufRead> Decoder<'a, R>
impl<'a, R: BufRead> Decoder<'a, R>
Sourcepub fn single_frame(self) -> Self
pub fn single_frame(self) -> Self
Sets this Decoder
to stop after the first frame.
By default, it keeps concatenating frames until EOF is reached.
Sourcepub fn with_prepared_dictionary<'b>(
reader: R,
dictionary: &DecoderDictionary<'b>,
) -> Result<Self>where
'b: 'a,
pub fn with_prepared_dictionary<'b>(
reader: R,
dictionary: &DecoderDictionary<'b>,
) -> Result<Self>where
'b: 'a,
Creates a new decoder, using an existing DecoderDictionary
.
The dictionary must be the same as the one used during compression.
Sourcepub fn recommended_output_size() -> usize
pub fn recommended_output_size() -> usize
Recommendation for the size of the output buffer.
Sourcepub fn get_mut(&mut self) -> &mut R
pub fn get_mut(&mut self) -> &mut R
Acquire a mutable reference to the underlying reader.
Note that mutation of the reader may result in surprising results if this decoder is continued to be used.
Sourcepub fn finish(self) -> R
pub fn finish(self) -> R
Return the inner Read
.
Calling finish()
is not required after reading a stream -
just use it if you need to get the Read
back.
Sourcepub fn set_parameter(&mut self, parameter: DParameter) -> Result<()>
pub fn set_parameter(&mut self, parameter: DParameter) -> Result<()>
Sets a decompression parameter on the decompression stream.
Sourcepub fn window_log_max(&mut self, log_distance: u32) -> Result<()>
pub fn window_log_max(&mut self, log_distance: u32) -> Result<()>
Sets the maximum back-reference distance.
The actual maximum distance is going to be 2^log_distance
.
This will need to at least match the value set when compressing.
Trait Implementations§
Source§impl<R: BufRead> Read for Decoder<'_, R>
impl<R: BufRead> Read for Decoder<'_, R>
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
1.36.0 · Source§fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
read
, except that it reads into a slice of buffers. Read moreSource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
can_vector
)1.0.0 · Source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
buf
. Read more1.0.0 · Source§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
buf
. Read more1.6.0 · Source§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
buf
. Read moreSource§fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
read_buf
)Source§fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
read_buf
)cursor
. Read more1.0.0 · Source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Read
. Read more