Apache Common Compress - 拆分 Zip 文件

Apache Common Compress - Split Zip file

我已使用 Apache Common Compress 库成功压缩或解压缩文件。现在的问题是,压缩文件需要通过 FTP/email 发送,而 10 MB 是要发送的文件的最大限制。

  1. 所以我需要知道如何生成自定义大小的文件?
  2. 如何解压缩文件?

谢谢。

您必须使用 Apache Common Compress 吗?否则这个答案对你来说可能很有趣:how to create java zip archives with a max file size limit

根据他们在“多卷档案”下的 zip 官方用户指南 :

If you want to create a split ZIP archive you use the constructor of ZipArchiveOutputStream that accepts a File argument and a size. The size determines the maximum size of a split segment - the size must be between 64kB and 4GB. While creating the archive, this will create several files fillowing the naming convention described above. The name of the File argument used inside of the constructor must use the extension zip.

来源:https://commons.apache.org/proper/commons-compress/zip.html