如何使用apache commons存档(zip)文件

时间:2017-04-30 11:31:21

标签: java apache-commons-compress

如何在java中存档两个文件?

我想到的代码如下:

public void archiveFiles(FileInputStream file1, FileInputStream file2, String fileName) throws IOException, ArchiveException {
  ZipArchiveOutputStream zipArchiveOutputStream = new ZipArchiveOutputStream(new File(fileName));
  ZipArchiveEntry zipArchiveEntry = new ZipArchiveEntry("");
  zipArchiveEntry.setSize(subpoenaFile.getChannel().size());
  zipArchiveOutputStream.putArchiveEntry(zipArchiveEntry);

但我被困住了;有人可以帮我完成这个吗?

0 个答案:

没有答案