Skip to content
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

Develop #17

Merged
merged 11 commits into from
Apr 5, 2024
Next Next commit
FEAT: updated to direct zstd decompression rather than using a decomp…
…ressor object
  • Loading branch information
sander-willems-bruker committed Jan 24, 2024
commit 05a39d2948446069c3aee52867804c5f993a227a
9 changes: 2 additions & 7 deletions src/file_readers/common/ms_data_blobs/processors.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::io::{prelude::*, BufReader};
use zstd::stream::read::Decoder;
use zstd::decode_all;

use super::readers::{MSDataBlob, MSDataBlobReader, MSDataBlobState};

Expand All @@ -17,11 +16,7 @@ impl MSDataBlobProcessor {
fn decompress(mut self) -> Self {
if self.ms_data_blob.data.len() != 0 {
let reader: &[u8] = &self.ms_data_blob.data;
let mut decoder: Decoder<BufReader<&[u8]>> = Decoder::new(reader)
.expect("Cannot set decoder. Are the bytes correct?");
let mut buf: Vec<u8> = Vec::new();
decoder
.read_to_end(&mut buf)
let buf = decode_all(reader)
.expect("Cannot decompress bytes. Are they zstd compressed?");
self.ms_data_blob.data = buf;
}
Expand Down