Skip to content

Implemented multi member gz decoder #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 2, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/crc.rs
Original file line number Diff line number Diff line change
@@ -35,6 +35,11 @@ impl Crc {
ffi::mz_crc32(self.crc, data.as_ptr(), data.len() as libc::size_t)
};
}

pub fn reset(&mut self) {
self.crc = 0;
self.amt = 0;
}
}

impl<R: Read> CrcReader<R> {
@@ -56,6 +61,10 @@ impl<R: Read> CrcReader<R> {
pub fn inner(&mut self) -> &mut R {
&mut self.inner
}

pub fn reset(&mut self) {
self.crc.reset();
}
}

impl<R: Read> Read for CrcReader<R> {
8 changes: 8 additions & 0 deletions src/deflate.rs
Original file line number Diff line number Diff line change
@@ -289,6 +289,14 @@ impl<R: BufRead> DecoderReaderBuf<R> {
mem::replace(&mut self.obj, r)
}

/// Resets the state of this decoder's data
///
/// This will reset the internal state of this decoder. It will continue
/// reading from the same stream.
pub fn reset_data(&mut self) {
self.data = Decompress::new(false);
}

/// Acquires a reference to the underlying stream
pub fn get_ref(&self) -> &R {
&self.obj
Loading