The first thing one might like to know is, which compression class to use? That depends on how you would like to use the data. If you will be writing the stream to a file, the GZipStream class includes additional headers that make it suitable for opening with the gzip tool. The DeflateStream class does not include headers and thus has a slightly smaller size at the expense of being less portable (which may not be a concern if the data never leaves the computer that is running the application)
Both compresson methods are based on industry standard algorithms that are free of patent protecton. This allows you to incorporate them into your application with out worrying about intellectual property concerns.
In later posts we will explore source code for compressing and decompressing streams, but it is important to note the compression size limits. (Which will be repeated each time compression is discussed)
GZipStream and DeflateStream classes can't compress files larger than 4GB
Additional Resources
System.IO.Compression.GZipStream
System.IO.Compression.DeflateStream
Using GZIP for compression in .NET
No comments:
Post a Comment