Are System.IO.Compression.GZipStream or System.IO.Compression.Deflate compatible with zlib compression?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
I've used GZipStream to compress the output from the .NET XmlSerializer and it has worked perfectly fine to decompress the result with gunzip (in cygwin), winzip and another GZipStream.
For reference, here's what I did in code:
Then, to decompress in c#
Using the 'file' utility in cygwin reveals that there is indeed a difference between the same file compressed with GZipStream and with GNU GZip (probably header information as others has stated in this thread). This difference, however, seems to not matter in practice.
I ran into this issue with Git objects. In that particular case, they store the objects as deflated blobs with a Zlib header, which is documented in RFC 1950. You can make a compatible blob by making a file that contains:
0x78 0x01
CM
= 8 = deflateCINFO
= 7 = 32Kb windowFCHECK
= 1 = checksum bits for this headerDeflateStream
DeflateStream
, big-endian format (MSB first)I made my own Adler implementation
And that was pretty much it.