Game Development Reference
internal static TestObject DecompressTestObject(byte input)
using (MemoryStream output = new MemoryStream(input))
using (GZipStream zipStream = new GZipStream(output,
BinaryFormatter formatter = new BinaryFormatter();
return (formatter.Deserialize(zipStream) as TestObject);
This chapter briefly covered part of data compression theory, though barely
scratching the surface of a complex topic, and then later jumped into implemen-
tation details for the GZipStream class introduced in .NET 2.0.
Data compression has been and always will be a crucial element of many tools,
especially with the projected increase in the volume of game content over the next
couple of years. Data compression also has its place with network tools where
bandwidth and transfer speed is limited.