ZLIB Compression in .NET

I recently encountered a situation where I needed to provide a compressed byte stream to Java’s Inflator class. This probably isn’t a situation that you run into a lot as a .NET developer, but to make a long story short, my FluentCassandra library had to send a compressed byte stream to the database server in order to execute a query. The part that got me scratching my head is the fact that nothing in .NET Framework mentions ZLIB as a supportable compression type. So I had to start hunting down the specification and found that you can actually generate ZLIB compatible compression with the DeflateStream. However the format that Java and other libraries expect has a header in the stream as well as an adler-32 checksum at the end. ...

May 12, 2012 · 2 min · 282 words · Nick Berardi