java zip拆分,如何将一个巨大的zip文件拆分成多个卷?

本文介绍了如何使用Java将一个大的ZIP文件拆分成多个小的ZIP卷。由于Java的标准库中没有直接提供这样的功能,作者提出了一种自定义的`ChunkedZippedOutputStream`类,该类在写入ZIP条目时会检查当前体积是否超过设定的最大限制,如果超过则关闭当前文件并创建新的ZIP卷。这个解决方案为处理大型ZIP文件提供了一个编程方式的实现。
摘要由CSDN通过智能技术生成

When I create a zip Archive via java.util.zip.*, is there a way to split the resulting archive in multiple volumes?

Let's say my overall archive has a filesize of 24 MB and I want to split it into 3 files on a limit of 10 MB per file.

Is there a zip API which has this feature? Or any other nice ways to achieve this?

Thanks

Thollsten

解决方案

I am not aware of any public API that will help you do that.

(Although if you do not want to do it programatically, there are utilities like WinSplitter that will do it)

I have not tried it but, every ZipEntry while using ZippedInput/OutputStream has a compressed size. You may get a rough estimate of the size of the zipped file while creating it. If you need 2MB of zipped files, then you can stop writing to a file after the cumulative size of entries become 1.9MB, taking .1MB for Manifest file and

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值