Closed drtconway closed 1 year ago
Without knowing what the problem is, I suspect the MultiGzDecoder
to be unnecessary and would rather use a GzDecoder
instead. If that still doesn't work, it should be possible to replace all usages of Gz*
with a Vec
to which to write and from which to read. That should make it possible to validate the data written more easily and see if that works as expected. If not, that should help to figure out where the issue is.
In the function write_64
use out.write_all(&buf)?;
in place of out.write(&buf)?;
to fix the error.
write
returns how many bytes were successfully written. If this is less than the number of bytes sent, you need to call write
again with the unwritten part of the buffer. write_all
handles this looping for you.
Thanks. I was pretty confident it was an error on my part, and glad to be told so! :)
(BTW, the MultiGzDecoder is a result of this being cut down from larger code that has to deal with reading various bioinformatics files which are compressed with bgzip and which have multiple streams.)
I'm fairly new with Rust, though I'm an experienced programmer, so it may be that I've failed to understand some rust-ism correctly.
I believe the following code should compress correctly compress the vector of integers into a string and then decompress them. Various cut down examples of this code succeed, so I'm a bit perplexed as to why it fails on this data.
I'm suspecting my code is wrong, not the library, but if so, I can't see why.
Also from my
Cargo.toml
:integers.txt