icsharpcode / SharpZipLib

#ziplib is a Zip, GZip, Tar and BZip2 library written entirely in C# for the .NET platform.
http://icsharpcode.github.io/SharpZipLib/
MIT License
3.73k stars 976 forks source link

fix(zip): fully implement async deflate #810

Closed piksel closed 1 year ago

piksel commented 1 year ago

Using the previously implemented parts of async deflate/ZipOutputStream would only work as long as the compressed size was lower than the internal deflater buffer. This fix adds async writing to DeflaterOutputStream and GzipOutputStream, and allows ZipOutputStream to empty it's buffer using asynchronous writes.

This also extends the test for ZipOutputStream to try with a larger source buffer and adds a test for GzipOutputStream for wholly-async IO.

Additionally, GzipOutputStream.ModifiedTime can now also be set. This was added to allow the tests to yield a predicable output.

I certify that I own, and have sufficient rights to contribute, all source code and related material intended to be compiled or integrated with the source code for the SharpZipLib open source product (the "Contribution"). My Contribution is licensed under the MIT License.