如何使用 Objective-C 解压缩/解压缩,包括单个文件检索
我需要在 Objective-C 中处理各种 rar/zip 文件。理想情况下,我希望在 rar/zip 版本方面尽可能灵活。我还希望在提取文件内容列表后能够仅从 rar/zip 文件中提取某些文件。
如果这还不够,我希望能够访问和修改 zip 注释。
这在 Objective-C 中很容易实现吗?我搜索了很多,发现很多半成品的库不能完成我想要的一切,或者只支持 rar 到版本 2,或者不支持提取单个文件。
我知道我可以使用 MacOS Panther 及更高版本附带的命令行解压缩工具,但这似乎不太优雅,并且对我处理 rar 文件没有帮助,因为默认情况下 MacOS 不附带任何解压缩应用程序。
任何人都可以向我指出一个可以处理这两种类型文件中的一种或另一种的不错的库,或者推荐处理此问题的最佳方法吗?我知道一个选择是包装 unrar 源代码,并包装 zlib 源代码,但这对我来说是一项艰巨的任务。如果没有其他选择,我会这样做 - 对此的任何建议或指导将不胜感激。
谢谢!
I have a need to handle various rar/zip files, in Objective-C. Ideally I'd like to be as flexible as possible in terms of rar/zip versions. I'd also like to be able to only extract certain files from the rar/zip files, after pulling out a list of the file contents.
If that wasn't enough, I'd like to be able to access and modify the zip comment.
Is this easily possible in objective-c? I've searched around a lot and found a lot of half-finished libraries that don't do everything I want, or only support rar up to version 2, or don't support extracting single files.
I know I could just use the command line unzip tool that ships with MacOS Panther and up, but this seems inelegant and doesn't help me with rar files, as no unrar application ships with MacOS by default.
Can anyone point me at a decent library that does one or the other of these two types of files, or a recommended best approach for dealing with this problem? I know that one option is to wrap the unrar source, and also wrap the zlib source, but this to me is a daunting task. If there's no other option I'll do it - any advice or guidance on this would be gratefully received.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,在 Objective C 中做到这一点很容易。对于 zip 文件,只需使用 ZLIB (它已经包含在 Mac OS 中X.RAR
并不是那么简单,寻找C 库(不是 Objective-C 库)C 库。与Objective-C相比,RAR的处理能力更强,并且您可以在Objective-C程序中使用您想要的所有C库。 。
Yes, doing that it's easy in objective C. For zip files just use ZLIB (it's already included in Mac OS X.
RAR is not that simple though. Look for a C library (not an Objective-C library). There will be way more C libraries for RAR handling than Objective-C ones. And you can use all C libraries you want within an Objective-C program.