Is .NET's GzipStream compatible with Qt's zlib-based qCompress/qUncompress? I believe the开发者_开发百科y both use the deflate algorithm, so would I be able to use .NET's DeflateStream or GzipStream to read data written by Qt's qCompress, and write data readable by Qt's qUncompress without reimplementing zlib in its entirety in .NET?
I doubt it. First, qCompress() puts data size in the first 4 bytes which has nothing to do with zlib standards. You may wish to skip those bytes, but that's a dirty hack. Second, GzipStream sounds like it reads Gzip format (zlib format designed for compressing files) when qCompress() uses compress2() call which uses another zlib format designed for in-memory compression.
qCompress() and qUncompress() are designed to work with each other and nothing more. If you need compatibility with other code, use zlib directly, it is easy and portable. In fact, we are doing it in our company - the server uses Qt, the clients use .Net and Java. Works perfectly.
精彩评论