
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
752
|
Chapter 12: Filesystem I/O
compression classes use the same compression/decompression algorithm (i.e., the
lossless Deflate algorithm as described in the RFC 1951: Deflate 1.3 specification).
You may be wondering why you would pick one class over the other if they use the
same algorithm. There is one good reason; the
GZipStream class adds a CRC check to
the file to determine if it has been corrupted. If the file has been corrupted, an
InvalidDataException is thrown with the statement “The CRC in GZip footer does
not match the CRC calculated from the decompressed data.” By catching this excep-
tion, you can determine if your data is corrupted.
See Also
See the “DeflateStream Class” and “GZipStream” topics in the MSDN
documentation.