gpt4 book ai didi

objective-c - 用于 TAR 归档和取消归档文件的 Cocoa 类

转载 作者:行者123 更新时间:2023-12-03 16:33:08 25 4
gpt4 key购买 nike

有人围绕文件的 tar 归档/取消归档编写了一个简单的 Cocoa 包装类吗?

我打算自己做这件事,除非有人已经慷慨地做到了。

编辑:有什么原因我不应该只围绕“tar”终端命令编写包装类吗? (通过 NSTask)?除非有人反对,这就是我现在打算做的。

最佳答案

在您自己执行此操作(至少是取消存档)之前,我建议您查看 The Unarchiver的来源。
它支持Zip、Tar-GZip、Tar-BZip2、RAR、7-zip、LhA、StuffIt等。

<小时/>

对于完整的归档/取消归档支持,还有libarchive
这是 BSD 许可并用 C 编写:http://code.google.com/p/libarchive/
(甚至还有一个 libarchivestatic library 分支用于 iOS)

Filter Support

  • gzip (read and write, uses zlib)
  • bzip2 (read and write, uses bzlib)
  • compress (read and write, uses an internal implementation)
  • uudecode (read only)
  • separate command-line compressors with fixed-signature auto-detection
  • xz and lzma (read and write using liblzma)
  • lzma (if you lack liblzma, you can get read-only lzma support through the lzmadec library; this will likely be dropped as soon as liblzma is stable and widely-available)
  • Starting with libarchive 2.7, most of the above will fall back to using command-line tools if the libraries were unavailable at build time. Note that the command-line tools are usually slower than using the libraries directly.

Archive Formats Supported

  • tar (read and write, including GNU extensions)
  • pax (read and write, including GNU and star extensions)
  • cpio (read and write, including odc and newc variants)
  • ISO9660 (read only, including Joliet and Rockridge extensions, with some limitations; write support starting with libarchive 2.9)
  • Zip (read only, with some limitations, uses zlib; write support starting with libarchive 2.8)
  • mtree (read and write, uses OpenSSL libraries for creating and verifying cryptographic hashes)
  • shar (write only)
  • ar (read and write, including BSD and GNU/SysV variants)
  • empty (read only; in particular, note that no other format will accept an empty file)
  • raw (read only, starting in libarchive 2.8)
  • xar (read only, starting in libarchive 2.8)

仅供记录:Apple private API rejection with libarchive (顺便说一句,问题已解决)

关于objective-c - 用于 TAR 归档和取消归档文件的 Cocoa 类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6179978/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com