Share via


Compression API

If you want to compress your data streams before sending them, there is a new API that can handle this task for you at the framework level. .NET Framework 2.0 has a new namespace called System.IO.Compression, which introduces a series of classes that provide compression and decompression capabilities. The namespace has three members: the DeflateStream and GZipStream classes and the CompressionMode enum. These classes allow you to easily compress data before you persist it or send it over the wire. The way these classes work is pretty straightforward. Just create an instance using one of the constructors that takes a stream and a CompressionMode, and the result will be a compressed stream that can be used to send, for instance, over the network.

Use the new Compression API to compress data streams using the Gzip or Deflate protocols