Closed yarvik closed 1 month ago
After playing with it some more, I found a way for it to work, by calling .close() on the stream. It appears that ZstdOutputStream does not implement/override flush() method (I am sure there's a reason for that), but .close() does write what's left in the buffer (via .writeChunk) So I just need to ensure I close the stream. So the issue is solved for me. Sorry for the alarm.
The streams must be closed to function properly.
When I write bytes through ZstdOutputStream it pushes none of the compressed byes (or any bytes). Analogous code with Snappy works ok. Compressing bytes via new ZstdCompressor() then calling compress() method works ok.
Code example:
Result:
I tried file output stream, also tried wrapping various out streams in BufferedOutputStream, just to see where the issue lies. It looks like issue lies in private ZstdOutputStream.compressIfNecessary() where it decides not to .writeChunk()