可可类,用于TAR存档和取消存档文件 [英] Cocoa class for TAR archiving and unarchiving files

查看:92
本文介绍了可可类,用于TAR存档和取消存档文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人用tar存档/取消存档编写了一个简单的Cocoa包装器类吗?

Has someone written a simple Cocoa wrapper class around tar archiving/unarchiving of files?

我打算自己做,除非有人已经亲切地做了

I plan on doing it myself, unless someone out there has graciously already done it.

编辑:有什么原因不应该我只为 tar终端命令编写包装类吗? (通过NSTask)?除非有任何异议,否则这就是我现在打算做的事情。

Are there any reasons I shouldn't just write a wrapper class around the "tar" terminal command? (via NSTask)? Unless there are any objections, this is what I now plan on doing.

推荐答案

在这样做之前(至少在取消存档之前,是)您自己,我建议您查看 Unarchiver 的来源。

它支持Zip,Tar-GZip,Tar-BZip2,RAR,7-zip,LhA,StuffIt等。

Before doing it (at least the unarchiving, that is) yourself I'd recommend taking a look at The Unarchiver's source.
It supports Zip, Tar-GZip, Tar-BZip2, RAR, 7-zip, LhA, StuffIt, etc.

或者,为获得完整的归档/取消归档支持,还有 libarchive

,它是BSD许可并以C语言编写: http://code.google.com/p/libarchive/

(甚至还有一个< libarchive 的一个href = https://github.com/davepeck/iOS-libarchive rel = nofollow noreferrer> 静态库 分支在 iOS 中)

Alternatively for full archiving/unarchiving support there is libarchive,
which is BSD licensed and written in C: http://code.google.com/p/libarchive/
(There even is a static library fork of libarchive for use in iOS)


过滤器支持


  • gzip(重新广告和写入,使用zlib)

  • bzip2(读取和写入,使用bzlib)

  • 压缩(读取和写入,使用内部实现)

  • uudecode(只读)

  • 具有固定签名自动检测功能的独立命令行压缩器

  • xz和lzma(使用liblzma进行读写)

  • lzma(如果您没有liblzma,则可以通过
    lzmadec库获得只读的lzma支持;一旦liblzma稳定之后
    就会下降
    并且广泛可用)

  • 从libarchive 2.7开始,以上大部分内容都将退回到使用
    命令行工具,如果在构建时库
    不可用。请注意,
    的命令行工具通常比直接使用
    库要慢。

  • 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.

支持的存档格式


  • tar(可读写,包括GNU扩展名)

  • pax(读写,包括GNU和star扩展名)

  • cpio(读写,包括odc和newc变体)

  • ISO9660(只读,包括Joliet和Rockridge扩展,具有
    的某些限制;以libarchive 2.9开头的写支持

  • 邮政编码(只读,有一些限制,使用zlib;从libarchive 2.8开始写入支持

  • mtree(读写,使用OpenSSL库创建和验证
    加密散列)

  • shar(仅写)

  • ar(可读写,包括BSD和GNU / SysV变体)

  • 为空(读仅;尤其要注意,没有其他格式可以接受
    一个空文件)

  • 原始(只读,从libarchive 2.8开始)

  • xar(只读,从libarchive 2.8开始)

  • 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)

仅作记录:使用libarchive的Apple私有API拒绝(问题已解决,顺便说一句)

Just for the record: Apple private API rejection with libarchive (question was solved, btw)

这篇关于可可类,用于TAR存档和取消存档文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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