Compose Multi-volume 7z Archive
Contents
[
Hide
Show
]Overview
Aspose.ZIP API lets you compose 7z archive split into several files (volumes). Aspose.ZIP API provides saveSplit methdod to compose such an archive.
Options for split archive
SplitSevenZipArchiveSaveOptions constructor requires two parameter: file name for every piece and size of the volume. Pieces will have .7z.001, .7z.002, .7z.003 … extensions. The last volume is usually smaller then regular one.
Compose multi-volume archive
The following code example demonstrates how to compose split 7z archive with 65536 bytes each piece, maybe except for the last one. File names would be part.7z.001, part.7z.002, part.7z.003, …
1File fi1 = new File("alice29.txt");
2File fi2 = new File("picture.png");
3
4try (SevenZipArchive archive = new SevenZipArchive(new SevenZipEntrySettings(new SevenZipLZMA2CompressionSettings()))) {
5 archive.createEntry("alice29.txt", fi1);
6 archive.createEntry("picture.png", fi2);
7 archive.saveSplit("C:\\Folder", new SplitSevenZipArchiveSaveOptions("volume", 65536));
8}
Multi-volume 7z allows encryption and any compression method applied, same as regular 7z archive.