ABL - The Problem Solver - .Net FAQ
 

Home
Mission
News
Blog
Tools
FAQ
Publications
Downloads
Contact
Contents

 

Frequently asked questions

.NET FAQ Visual FoxPro FAQ

 


LZO.NET High-speed compression for .NET

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));
 

Even though no mention is made of .NET 2.0 it still works just as advertised.

 
Take a look at http://lzo-net.sourceforge.net/ for the LZO.NET project or http://www.oberhumer.com/ for the original LZO project.

 


 

Send mail to webmaster@TheProblemSolver.nl with questions or comments about this web site.
Copyright © 1995 - 2007 ABL - The Problem Solver
Last modified: 10/21/06
WF
RSS 2.0