I'm compressing some packets of data using the GZipStream class within the .NET framework. Everything works fine and the compression ratio is OK, but when I peek at the compressed data using a hex editor I noticed that as much as a third of each compressed packet is trailing zeroes. Is this normal?
Presumably GZipStream is a block based compressor and the output is padded to align with some block size? Are there some alternatives that are equally stable, as well supported but without this issue? (I figure I can gain another 10-30% compression by using a similar compression algorithm that doesn't pad so excessively).
MemoryStream.GetBuffer
instead ofMemoryStream.ToArray
or aFileStream
would cause such issues. – CodesInChaos