Removed ChunkInfo and added additional functions on decoder
This commit is contained in:
1 parent
5cadbffebf
commit
802949f6e1
7 files changed
+69
-108
No files matched your search
@@ -53,7 +53,7 @@ impl Compression for Deflate {
|
||||
impl CompressionAlgorithm for Deflate {
|
||||
fn write_to<W: Write>(&mut self, writer: &mut W, bytes: &[u8]) -> Result<u64, io::Error> {
|
||||
let mut encoder = ZlibEncoder::new(writer, self.level);
|
||||
encoder.write_all(&bytes)?;
|
||||
encoder.write_all(bytes)?;
|
||||
encoder.try_finish()?;
|
||||
Ok(encoder.total_out())
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ mod tests {
|
||||
let mut compressed_data = Vec::<u8>::new();
|
||||
let mut writer = Cursor::new(&mut compressed_data);
|
||||
Packbits::default()
|
||||
.write_to(&mut writer, &UNCOMPRESSED_DATA)
|
||||
.write_to(&mut writer, UNCOMPRESSED_DATA)
|
||||
.unwrap();
|
||||
assert_eq!(compressed_data, EXPECTED_COMPRESSED_DATA);
|
||||
}
|
||||
@@ -207,7 +207,7 @@ mod tests {
|
||||
let mut compressed_data = Vec::<u8>::new();
|
||||
let mut writer = Cursor::new(&mut compressed_data);
|
||||
Packbits::default()
|
||||
.write_to(&mut writer, &TEST_DATA)
|
||||
.write_to(&mut writer, TEST_DATA)
|
||||
.unwrap();
|
||||
assert_eq!(compressed_data, EXPECTED_COMPRESSED_DATA);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user