iPhone 上的压缩 API [英] Compression API on the iPhone

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

问题描述

是否有可在 iPhone 上使用的压缩 API?我们正在为我们的 iPhone 应用构建一些 RESTful 网络服务以供与之对话,但我们希望至少压缩一些对话以提高效率.

Is there a compression API available for use on the iPhone? We're building some RESTful web services for our iPhone app to talk to, but we want to compress at least some of the conversations for efficiency.

我不在乎格式(ZIP、LHA 等)是什么,也不需要安全.

I don't care what the format (ZIP, LHA, whatever) is, and it does not need to be secure.

一些受访者指出,服务器可以压缩其输出,而 iPhone 可以使用它.我们的情况正好相反.我们将发布压缩内容网络服务.我们不关心压缩的另一种方式.

Some respondents have pointed out that the server can compress its output, and the iPhone can consume that. The scenario we have is exactly the reverse. We'll be POSTing compressed content to the web service. We're not concerned with compression going the other way.

推荐答案

zlib 和 bzip2 可用.而且你总是可以添加其他人,只要他们(通常)可以在 OS X 下编译.

zlib and bzip2 are available. And you can always add others, as long as they'll (generally) compile under OS X.

bzip2 是最小文件大小的更好选择,但需要更多的 CPU 能力来压缩和解压缩.

bzip2 is a better choice for smallest file sizes, but requires much more CPU power to compress and decompress.

此外,由于您正在与 Web 服务对话,因此您可能不必做太多事情.NSURLRequest 在服务器响应中透明地接受 gzip 编码.

Also, since you're talking to a web service, you may not have to do much. NSURLRequest accepts gzip encoding transparently in server responses.

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

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