Apache Commons Compress 压缩zip

时间:2025-04-10 07:36:59
public class ScatterSample {
	ParallelScatterZipCreator scatterZipCreator = new ParallelScatterZipCreator();
	ScatterZipOutputStream dirs = (("scatter-dirs", "tmp"));

	public ScatterSample() throws IOException {
	}

	public void addEntry(ZipArchiveEntry zipArchiveEntry, InputStreamSupplier streamSupplier) throws IOException {
		if (() && !())
			((zipArchiveEntry, streamSupplier));
		else
			(zipArchiveEntry, streamSupplier);
	}

	public void writeTo(ZipArchiveOutputStream zipArchiveOutputStream)
			throws IOException, ExecutionException, InterruptedException {
		(zipArchiveOutputStream);
		();
		(zipArchiveOutputStream);
	}
}

4.调用方式

public class ZipInputStream implements InputStreamSupplier{

	@Override
	public InputStream get() {
		InputStream inputStream = null;
		try {
			inputStream = new FileInputStream(new File("f:/"));
		} catch (FileNotFoundException e) {
			();
		}
		return inputStream;
	}

}
		ScatterSample scatterSample = new ScatterSample();
		ZipArchiveOutputStream zipArchiveOutputStream = new ZipArchiveOutputStream(new File("f:/"));
		ZipArchiveEntry entry = new ZipArchiveEntry("");
		(());
		(entry, new ZipInputStream());
		(zipArchiveOutputStream);
		();


5.说两句

这个是我的测试,要用的话,请自行整理出来,灵活调用,是我提前准备压缩进的文件,您需要事先准备该文件,是自动生成的,不用管。