Looking for a compression library that gets around? LZO is a fast compression
library that was actually uses on the NASA rovers Spirit and Opportunity.
Michael Link created a .NET wrapper class so using it is a breeze. The following
is the sample application listed on the LZO.NET home page:
// Create the compressor object
LZOCompressor lzo =
newLZOCompressor();
// Build a quite redundant string
StringBuilder sb =
newStringBuilder();
for (int
i = 0; i < 10000; i++)
{
sb.Append("LZO.NET");
}
string str =
sb.ToString();
Console.WriteLine("Original-Length:
" + str.Length);
// Now compress the 70000 byte
string to something much smaller
byte[] compressed =
lzo.Compress(Encoding.Default.GetBytes(str));
Console.WriteLine("Compressed-Length:
" + compressed.Length);
// Decompress the string to its
original content
string str2 =
Encoding.Default.GetString(lzo.Decompress(compressed));
Console.WriteLine("Decompressed-Length:
" + str2.Length);
Console.WriteLine("Equality:
" + str.Equals(str2));