Compose Multi-volume Zip Archive

Overview

Aspose.ZIP API lets you compose zip archive split into several files. Aspose.ZIP API provides  saveSplit methdod to compose such an archive. 

Options for split archive

SplitArchiveSaveOptions constructor requires two parameter: file name for every piece and size of the volume. The last piece will get .zip extension, the others will have .z01, .z02, z03 … extensions. The last volume is usually smaller then regular one.

Compose multi-volume archive

The following code example demonstrates how to compose split zip archive with 65536 bytes each piece, maybe except for the last one. File names would be part.z01, part.z02, part.z03, …, part.zip.

1File fi1 = new File("alice29.txt");
2File fi2 = new File("Bible.txt");
3try (Archive archive = new Archive(new ArchiveEntrySettings(new DeflateCompressionSettings()))) {
4    archive.createEntry("alice29.txt", fi1);
5    archive.createEntry("Bible.txt", fi2);
6    archive.saveSplit("C:\\destination\\", new SplitArchiveSaveOptions("part", 65536));
7}

Multi-volume zip allows any encryption and compression method applied, same as regular zip.

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.