Skip to content

Commit b36a942

Browse files
authored
Merge pull request #43 from veldsla/multigz
Implemented multi member gz decoder
2 parents f8a20de + 7a2f0e7 commit b36a942

File tree

7 files changed

+274
-85
lines changed

7 files changed

+274
-85
lines changed

src/crc.rs

+9
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ impl Crc {
3535
ffi::mz_crc32(self.crc, data.as_ptr(), data.len() as libc::size_t)
3636
};
3737
}
38+
39+
pub fn reset(&mut self) {
40+
self.crc = 0;
41+
self.amt = 0;
42+
}
3843
}
3944

4045
impl<R: Read> CrcReader<R> {
@@ -56,6 +61,10 @@ impl<R: Read> CrcReader<R> {
5661
pub fn inner(&mut self) -> &mut R {
5762
&mut self.inner
5863
}
64+
65+
pub fn reset(&mut self) {
66+
self.crc.reset();
67+
}
5968
}
6069

6170
impl<R: Read> Read for CrcReader<R> {

src/deflate.rs

+8
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,14 @@ impl<R: BufRead> DecoderReaderBuf<R> {
289289
mem::replace(&mut self.obj, r)
290290
}
291291

292+
/// Resets the state of this decoder's data
293+
///
294+
/// This will reset the internal state of this decoder. It will continue
295+
/// reading from the same stream.
296+
pub fn reset_data(&mut self) {
297+
self.data = Decompress::new(false);
298+
}
299+
292300
/// Acquires a reference to the underlying stream
293301
pub fn get_ref(&self) -> &R {
294302
&self.obj

0 commit comments

Comments
 (0)