兼容Zlib的压缩流? [英] Zlib-compatible compression streams?

查看:166
本文介绍了兼容Zlib的压缩流?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Are System.IO.Compression.GZipStream or System.IO.Compression.Deflate compatible with zlib compression?

解决方案

有关System.IO.Compression的 MSDN 。 GZipStream:


此类表示gzip数据格式,它使用行业标准算法进行无损文件压缩和解压缩。


zlib常见问题


另一方面,zlib中的gz *函数使用gzip格式。


因此,zlib和GZipStream应该是可互操作的,但前提是您使用zlib函数来处理gzip格式。



System.IO.Compression.Deflate和zlib据说不能互操作。



如果你需要处理zip文件(你可能不会,但别人可能需要此),您需要使用 SharpZipLib 或其他第三方库。 / p>

Are System.IO.Compression.GZipStream or System.IO.Compression.Deflate compatible with zlib compression?

解决方案

From MSDN about System.IO.Compression.GZipStream:

This class represents the gzip data format, which uses an industry standard algorithm for lossless file compression and decompression.

From the zlib FAQ:

The gz* functions in zlib on the other hand use the gzip format.

So zlib and GZipStream should be interoperable, but only if you use the zlib functions for handling the gzip-format.

System.IO.Compression.Deflate and zlib are reportedly not interoperable.

If you need to handle zip files (you probably don't, but someone else might need this) you need to use SharpZipLib or another third-party library.

这篇关于兼容Zlib的压缩流?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆