private static final int BUFFER_SIZE = 16 * 1024;
public static void addFilesToExistingZip(File zipFile,File[] files) throws IOException {
// get a temp file
File tempFile = File.createTempFile(zipFile.getName(), null);
// delete it, otherwise you cannot rename your existing zip to it.
tempFile.delete();
boolean renameOk=zipFile.renameTo(tempFile);
if (!renameOk)
{
throw new RuntimeExceptio
JAVA向现有压缩包内追加文件方法
最新推荐文章于 2024-06-29 03:26:11 发布
本文介绍如何使用Java编程向已有的ZIP或JAR压缩包中添加文件,包括解析压缩包、创建新文件项、写入数据以及更新压缩包的详细步骤,适合需要进行文件操作的开发者参考。
摘要由CSDN通过智能技术生成