Compressing Data with Streams

One of the most interesting features of streams is the ability to compress and decompress data utilizing the GZipStream and DeflateStream objects. Both are exposed by the System.IO.Compression namespace, and they both compress data using the GZip algorithm. The only difference is that the GZipStream writes a small header to compressed data. The interesting thing is that they work similarly to other streams, and when you write or read data into the stream, data is automatically compressed or decompressed by the runtime. The good news is that you are not limited to compressing files, but any other kind of stream. Compressing and decompressing data is quite a simple task. In some situations you need more attention according ...

Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.