Compression Classes Enhance I/O in .NET 2.0
Decompression is more complex because of the way the Read method works. Because the file is compressed, there is no way to know how much data to read. You can approach this in a number of ways. For this sample code, I added code up front to determine the size of the file first. This results in the file being read twice, which is not ideal.
Figure 2. File Decompression
Compression and Decompression Classes
You have received a sneak preview of the compression and decompression classes that are coming in the .NET Framework 2.0, due out later in the year. The simplicity of the examples demonstrates how easy it will be for you to use the functionality within your applications.
The topic of the next column will be the serialization enhancements in .NET Framework 2.0. If you have something in particular that you would like to see explained here, contact me at firstname.lastname@example.org.
About the Author
Mark Strawmyer, MCSD, MCSE, MCDBA is a Senior Architect of .NET applications for large and mid-size organizations. Mark is a technology leader with Crowe Chizek in Indianapolis, Indiana. He specializes in architecture, design, and development of Microsoft-based solutions. Mark was honored to be named a Microsoft MVP for application development with C# for the second year in a row. You can reach Mark at email@example.com.
Page 2 of 2