There are 2 problems with this class.
- It does not handle ZIP files.
- It is dysfunctional, can actually inflate data in "compression". There's something wrong with the logic. It's a known problem but as yet unfixed.
On the first item, the Deflate compression algorithm is what is used in .zip files. A GZIP stream is just a DEFLATEd stream with a header and trailer surrounding it. A zip file is a set of DEFLATEd streams with metadata surrounding all of them. This class helps you read or write a GZIP stream, but it will not help you read or write a zip file. A GZIP file (sometimes with the extension .gz) is not the same thing as a ZIP file. Similar ideas but not the same thing.
The java.util.zip classes do handle .zip files. These classes are available through the VJ# runtime. But, there are a few problems with them: (1) the java classes are unwieldy to use in .NET. There are no progress events, for example. The enumeration is all Java-esque. etc.; (2) there are a bunch of bugs in those classes that have not been and will not be fixed in the VJ# runtime; (3) the VJ# runtime is huge; (4) The VJ# runtime is no longer supported! (not shipped with VS2008).
There is a good 3rd party library, though, that solves all these problems: DotNetZip. It provides a GZipStream that NEVER inflates your data, and actually deflates it substantially
better than the built-in class. Also, DotNetZip can read and write .zip files.
Find it at:
http://www.codeplex.com/DotNetZipIt's free to use. It is written in C#, but you can use it from any language. It works in Winforms apps, console apps, ASP.NET apps, Powershell, anything you write in .NET. Fast, good compression (better than the built-in GZipStream). Easy to use. You'll find lots of examples on that site.