问题描述
是否有一种简单的标准方法来解压缩Objective-C中的gzip原始数据缓冲区?在Apple Developer文档中找不到有用的东西.
Is there a simple, standard way to decompress a gzip raw data buffer in Objective-C? I could not find anything useful in the Apple Developer documentation.
如果没有,您能否指出我的代码演练,一个库,让我的生活更轻松的任何事情?我不怕写C代码.
If not, can you point me to a code walk-through, a library, anything that will make my life easier? I am not afraid to write C code.
推荐答案
cocoadev提供了一个NSData类别,可以处理zlib和gzip数据: http://www.cocoadev.com/index.pl?NSDataCategory
There is a NSData category available at cocoadev that can handle zlib and gzip data:http://www.cocoadev.com/index.pl?NSDataCategory
如果只需要gzip解压缩,则可以删除zlib&与哈希相关的方法.
不要忘记添加一个链接libz.dylib(OS X标准库)构建阶段.
If you just need gzip decompression, you can remove the zlib & hash related methods.
Don't forget to add a link libz.dylib (OS X standard library) build phase.
更新
正如marcos1490在评论中指出的那样,原始的CocoaDev条目消失了,但是有人扩展了NSData类别并写下了它: http://deusty.blogspot.de/2007/07/gzip-compressiondecompression.html
Update
As pointed out by marcos1490 in the comments, the original CocoaDev entry disappeared, but someone extended that NSData category and wrote about it: http://deusty.blogspot.de/2007/07/gzip-compressiondecompression.html
这篇关于在Objective-C中解压缩gzip数据流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!