SevenZipArchive

Inheritance: java.lang.Object, com.aspose.zip.ILicenseStateProvider

All Implemented Interfaces: com.aspose.zip.IArchive, java.lang.AutoCloseable

public class SevenZipArchive extends ILicenseStateProvider implements IArchive, AutoCloseable

This class represents 7z archive file. Use it to compose and extract 7z archives.

Constructors

ConstructorDescription
SevenZipArchive()Initializes a new instance of the SevenZipArchive class with optional settings for its entries.
SevenZipArchive(SevenZipEntrySettings newEntrySettings)Initializes a new instance of the SevenZipArchive class with optional settings for its entries.
SevenZipArchive(InputStream sourceStream)Initializes a new instance of the SevenZipArchive class and composes entries list can be extracted from the archive.
SevenZipArchive(InputStream sourceStream, String password)Initializes a new instance of the SevenZipArchive class and composes entries list can be extracted from the archive.
SevenZipArchive(String path)Initializes a new instance of the SevenZipArchive class and composes entries list can be extracted from the archive.
SevenZipArchive(String path, String password)Initializes a new instance of the SevenZipArchive class and composes entries list can be extracted from the archive.
SevenZipArchive(String[] parts)Initializes a new instance of the SevenZipArchive class from multi-volume 7z archive and composes entries list can be extracted from the archive.
SevenZipArchive(String[] parts, String password)Initializes a new instance of the SevenZipArchive class from multi-volume 7z archive and composes entries list can be extracted from the archive.

Methods

MethodDescription
close(){@inheritDoc}
createEntries(File directory)Adds to the archive all files and directories recursively in the directory given.
createEntries(File directory, boolean includeRootDirectory)Adds to the archive all files and directories recursively in the directory given.
createEntries(String sourceDirectory)Adds to the archive all files and directories recursively in the directory given.
createEntries(String sourceDirectory, boolean includeRootDirectory)Adds to the archive all files and directories recursively in the directory given.
createEntry(String name, File file)Create single entry within the archive.
createEntry(String name, File file, boolean openImmediately)Create single entry within the archive.
createEntry(String name, File file, boolean openImmediately, SevenZipEntrySettings newEntrySettings)Create single entry within the archive.
createEntry(String name, InputStream source)Create single entry within the archive.
createEntry(String name, InputStream source, SevenZipEntrySettings newEntrySettings)Create single entry within the archive.
createEntry(String name, InputStream source, SevenZipEntrySettings newEntrySettings, File file)Create single entry within the archive.
createEntry(String name, String path)Create single entry within the archive.
createEntry(String name, String path, boolean openImmediately)Create single entry within the archive.
createEntry(String name, String path, boolean openImmediately, SevenZipEntrySettings newEntrySettings)Create single entry within the archive.
dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
extractToDirectory(String destinationDirectory)Extracts all the files in the archive to the directory provided.
extractToDirectory(String destinationDirectory, String password)Extracts all the files in the archive to the directory provided.
getEntries()Gets entries of SevenZipArchiveEntry type constituting the archive.
getFileEntries()Gets entries of IArchiveFileEntry type constituting the 7z archive.
getNewEntrySettings()Compression and encryption settings used for newly added SevenZipArchiveEntry items.
save(OutputStream output)Saves 7z archive to the stream provided.
save(String destinationFileName)Saves archive to destination file provided.
saveSplit(String destinationDirectory, SplitSevenZipArchiveSaveOptions options)Saves multi-volume archive to destination directory provided.

SevenZipArchive()

public SevenZipArchive()

Initializes a new instance of the SevenZipArchive class with optional settings for its entries.

The following example shows how to compress a single file with default settings: LZMA compression without encryption.


     try (FileOutputStream sevenZipFile = new FileOutputStream("archive.7z")) {
         try (SevenZipArchive archive = new SevenZipArchive()) {
             archive.createEntry("data.bin", "file.dat");
             archive.save(sevenZipFile);
         }
     } catch (IOException ex) {
     }
 

LZMA compression without encryption would be used.

SevenZipArchive(SevenZipEntrySettings newEntrySettings)

public SevenZipArchive(SevenZipEntrySettings newEntrySettings)

Initializes a new instance of the SevenZipArchive class with optional settings for its entries.

The following example shows how to compress a single file with default settings: LZMA compression without encryption.


     try (FileOutputStream sevenZipFile = new FileOutputStream("archive.7z")) {
         try (SevenZipArchive archive = new SevenZipArchive()) {
             archive.createEntry("data.bin", "file.dat");
             archive.save(sevenZipFile);
         }
     } catch (IOException ex) {
     }
 

Parameters:

ParameterTypeDescription
newEntrySettingsSevenZipEntrySettingscompression and encryption settings used for newly added SevenZipArchiveEntry items. If not specified, LZMA compression without encryption would be used

SevenZipArchive(InputStream sourceStream)

public SevenZipArchive(InputStream sourceStream)

Initializes a new instance of the SevenZipArchive class and composes entries list can be extracted from the archive.


     try (SevenZipArchive archive = new SevenZipArchive(new FileInputStream("archive.7z"))) {
         archive.extractToDirectory("C:\\extracted");
     } catch (FileNotFoundException ex) {
     }
 

This constructor does not decompress any entry. See extractToDirectory(String, String) method for decompressing.

Parameters:

ParameterTypeDescription
sourceStreamjava.io.InputStreamthe source of the archive

SevenZipArchive(InputStream sourceStream, String password)

public SevenZipArchive(InputStream sourceStream, String password)

Initializes a new instance of the SevenZipArchive class and composes entries list can be extracted from the archive.


     try (SevenZipArchive archive = new SevenZipArchive(new FileInputStream("archive.7z"))) {
         archive.extractToDirectory("C:\\extracted");
     } catch (FileNotFoundException ex) {
     }
 

This constructor does not decompress any entry. See extractToDirectory(String, String) method for decompressing.

Parameters:

ParameterTypeDescription
sourceStreamjava.io.InputStreamthe source of the archive
passwordjava.lang.Stringoptional password for decryption. If file names are encrypted it must be present

SevenZipArchive(String path)

public SevenZipArchive(String path)

Initializes a new instance of the SevenZipArchive class and composes entries list can be extracted from the archive.


     try (SevenZipArchive archive = new SevenZipArchive("archive.7z")) {
         archive.extractToDirectory("C:\\extracted");
     } catch (FileNotFoundException ex) {
     }
 

This constructor does not decompress any entry. See extractToDirectory(String, String) method for decompressing.

Parameters:

ParameterTypeDescription
pathjava.lang.Stringthe fully qualified or the relative path to the archive file

SevenZipArchive(String path, String password)

public SevenZipArchive(String path, String password)

Initializes a new instance of the SevenZipArchive class and composes entries list can be extracted from the archive.


     try (SevenZipArchive archive = new SevenZipArchive("archive.7z")) {
         archive.extractToDirectory("C:\\extracted");
     } catch (FileNotFoundException ex) {
     }
 

This constructor does not decompress any entry. See extractToDirectory(String, String) method for decompressing.

Parameters:

ParameterTypeDescription
pathjava.lang.Stringthe fully qualified or the relative path to the archive file
passwordjava.lang.Stringoptional password for decryption. If file names are encrypted it must be present

SevenZipArchive(String[] parts)

public SevenZipArchive(String[] parts)

Initializes a new instance of the SevenZipArchive class from multi-volume 7z archive and composes entries list can be extracted from the archive.


     try (SevenZipArchive archive = new SevenZipArchive(new String[] { "multi.7z.001", "multi.7z.002", "multi.7z.003" } )) {
         archive.extractToDirectory("C:\\extracted");
     }
 

Parameters:

ParameterTypeDescription
partsjava.lang.String[]paths to each segment of multi-volume 7z archive respecting order

SevenZipArchive(String[] parts, String password)

public SevenZipArchive(String[] parts, String password)

Initializes a new instance of the SevenZipArchive class from multi-volume 7z archive and composes entries list can be extracted from the archive.


     try (SevenZipArchive archive = new SevenZipArchive(new String[] { "multi.7z.001", "multi.7z.002", "multi.7z.003" } )) {
         archive.extractToDirectory("C:\\extracted");
     }
 

Parameters:

ParameterTypeDescription
partsjava.lang.String[]paths to each segment of multi-volume 7z archive respecting order
passwordjava.lang.Stringoptional password for decryption. If file names are encrypted it must be present

close()

public void close()

createEntries(File directory)

public final SevenZipArchive createEntries(File directory)

Adds to the archive all files and directories recursively in the directory given.


     try (SevenZipArchive archive = new SevenZipArchive()) {
         File folder = new File("C:\\folder");
         archive.createEntries(folder);
         archive.save("folder.7z");
     }
 

Parameters:

ParameterTypeDescription
directoryjava.io.Filedirectory to compress

Returns: SevenZipArchive - the archive with entries composed

createEntries(File directory, boolean includeRootDirectory)

public final SevenZipArchive createEntries(File directory, boolean includeRootDirectory)

Adds to the archive all files and directories recursively in the directory given.


     try (SevenZipArchive archive = new SevenZipArchive()) {
         File folder = new File("C:\\folder");
         archive.createEntries(folder);
         archive.save("folder.7z");
     }
 

Parameters:

ParameterTypeDescription
directoryjava.io.Filedirectory to compress
includeRootDirectorybooleanindicates whether to include the root directory itself or not

Returns: SevenZipArchive - the archive with entries composed

createEntries(String sourceDirectory)

public final SevenZipArchive createEntries(String sourceDirectory)

Adds to the archive all files and directories recursively in the directory given.

Compose 7z archive with LZMA compression.


     try (SevenZipArchive archive = new SevenZipArchive(new SevenZipEntrySettings(new SevenZipLZMACompressionSettings()))) {
         archive.createEntries("C:\\folder");
         archive.save("folder.7z");
     }
 

Parameters:

ParameterTypeDescription
sourceDirectoryjava.lang.Stringdirectory to compress

Returns: SevenZipArchive - the archive with entries composed

createEntries(String sourceDirectory, boolean includeRootDirectory)

public final SevenZipArchive createEntries(String sourceDirectory, boolean includeRootDirectory)

Adds to the archive all files and directories recursively in the directory given.

Compose 7z archive with LZMA compression.


     try (SevenZipArchive archive = new SevenZipArchive(new SevenZipEntrySettings(new SevenZipLZMACompressionSettings()))) {
         archive.createEntries("C:\\folder");
         archive.save("folder.7z");
     }
 

Parameters:

ParameterTypeDescription
sourceDirectoryjava.lang.Stringdirectory to compress
includeRootDirectorybooleanindicates whether to include the root directory itself or not

Returns: SevenZipArchive - the archive with entries composed

createEntry(String name, File file)

public final SevenZipArchiveEntry createEntry(String name, File file)

Create single entry within the archive.

Compose archive with entries encrypted with different passwords each.


     try (FileOutputStream sevenZipFile = new FileOutputStream("archive.7z")) {
         File fi1 = new File("data1.bin");
         File fi2 = new File("data2.bin");
         File fi3 = new File("data3.bin");

         try (SevenZipArchive archive = new SevenZipArchive()) {
             archive.createEntry("entry1.bin", fi1, false, new SevenZipEntrySettings(new SevenZipStoreCompressionSettings(), new SevenZipAESEncryptionSettings("test1")));
             archive.createEntry("entry2.bin", fi2, false, new SevenZipEntrySettings(new SevenZipStoreCompressionSettings(), new SevenZipAESEncryptionSettings("test2")));
             archive.createEntry("entry3.bin", fi3, false, new SevenZipEntrySettings(new SevenZipStoreCompressionSettings(), new SevenZipAESEncryptionSettings("test3")));
             archive.save(sevenZipFile);
         }
     } catch (IOException ex) {
     }
 

The entry name is solely set within name parameter. The file name provided in file parameter does not affect the entry name.

Parameters:

ParameterTypeDescription
namejava.lang.Stringthe name of the entry
filejava.io.Filethe metadata of file to be compressed

Returns: SevenZipArchiveEntry - Seven Zip entry instance

createEntry(String name, File file, boolean openImmediately)

public final SevenZipArchiveEntry createEntry(String name, File file, boolean openImmediately)

Create single entry within the archive.

Compose archive with entries encrypted with different passwords each.


     try (FileOutputStream sevenZipFile = new FileOutputStream("archive.7z")) {
         File fi1 = new File("data1.bin");
         File fi2 = new File("data2.bin");
         File fi3 = new File("data3.bin");

         try (SevenZipArchive archive = new SevenZipArchive()) {
             archive.createEntry("entry1.bin", fi1, false, new SevenZipEntrySettings(new SevenZipStoreCompressionSettings(), new SevenZipAESEncryptionSettings("test1")));
             archive.createEntry("entry2.bin", fi2, false, new SevenZipEntrySettings(new SevenZipStoreCompressionSettings(), new SevenZipAESEncryptionSettings("test2")));
             archive.createEntry("entry3.bin", fi3, false, new SevenZipEntrySettings(new SevenZipStoreCompressionSettings(), new SevenZipAESEncryptionSettings("test3")));
             archive.save(sevenZipFile);
         }
     } catch (IOException ex) {
     }
 

The entry name is solely set within name parameter. The file name provided in file parameter does not affect the entry name.

If the file is opened immediately with openImmediately parameter it becomes blocked until archive is saved.

Parameters:

ParameterTypeDescription
namejava.lang.Stringthe name of the entry
filejava.io.Filethe metadata of file to be compressed
openImmediatelybooleantrue if open the file immediately, otherwise open the file on archive saving

Returns: SevenZipArchiveEntry - Seven Zip entry instance

createEntry(String name, File file, boolean openImmediately, SevenZipEntrySettings newEntrySettings)

public final SevenZipArchiveEntry createEntry(String name, File file, boolean openImmediately, SevenZipEntrySettings newEntrySettings)

Create single entry within the archive.

Compose archive with entries encrypted with different passwords each.


     try (FileOutputStream sevenZipFile = new FileOutputStream("archive.7z")) {
         File fi1 = new File("data1.bin");
         File fi2 = new File("data2.bin");
         File fi3 = new File("data3.bin");

         try (SevenZipArchive archive = new SevenZipArchive()) {
             archive.createEntry("entry1.bin", fi1, false, new SevenZipEntrySettings(new SevenZipStoreCompressionSettings(), new SevenZipAESEncryptionSettings("test1")));
             archive.createEntry("entry2.bin", fi2, false, new SevenZipEntrySettings(new SevenZipStoreCompressionSettings(), new SevenZipAESEncryptionSettings("test2")));
             archive.createEntry("entry3.bin", fi3, false, new SevenZipEntrySettings(new SevenZipStoreCompressionSettings(), new SevenZipAESEncryptionSettings("test3")));
             archive.save(sevenZipFile);
         }
     } catch (IOException ex) {
     }
 

The entry name is solely set within name parameter. The file name provided in file parameter does not affect the entry name.

If the file is opened immediately with openImmediately parameter it becomes blocked until archive is saved.

Parameters:

ParameterTypeDescription
namejava.lang.Stringthe name of the entry
filejava.io.Filethe metadata of file to be compressed
openImmediatelybooleantrue if open the file immediately, otherwise open the file on archive saving
newEntrySettingsSevenZipEntrySettingscompression and encryption settings used for added SevenZipArchiveEntry item

Returns: SevenZipArchiveEntry - Seven Zip entry instance

createEntry(String name, InputStream source)

public final SevenZipArchiveEntry createEntry(String name, InputStream source)

Create single entry within the archive.

Compose 7z archive with LZMA compression and encryption of all entries.


     try (SevenZipArchive archive = new SevenZipArchive(new SevenZipEntrySettings(new SevenZipLZMACompressionSettings(), new SevenZipAESEncryptionSettings("p@s$")))) {
         archive.createEntry("data.bin", new ByteArrayInputStream(new byte[] {0x00, (byte)0xFF} ));
         archive.save("archive.7z");
     }
 

Parameters:

ParameterTypeDescription
namejava.lang.Stringthe name of the entry
sourcejava.io.InputStreamthe input stream for the entry

Returns: SevenZipArchiveEntry - Seven Zip entry instance

createEntry(String name, InputStream source, SevenZipEntrySettings newEntrySettings)

public final SevenZipArchiveEntry createEntry(String name, InputStream source, SevenZipEntrySettings newEntrySettings)

Create single entry within the archive.

Compose 7z archive with LZMA compression and encryption of all entries.


     try (SevenZipArchive archive = new SevenZipArchive(new SevenZipEntrySettings(new SevenZipLZMACompressionSettings(), new SevenZipAESEncryptionSettings("p@s$")))) {
         archive.createEntry("data.bin", new ByteArrayInputStream(new byte[] {0x00, (byte)0xFF} ));
         archive.save("archive.7z");
     }
 

Parameters:

ParameterTypeDescription
namejava.lang.Stringthe name of the entry
sourcejava.io.InputStreamthe input stream for the entry
newEntrySettingsSevenZipEntrySettingscompression and encryption settings used for added SevenZipArchiveEntry item

Returns: SevenZipArchiveEntry - Seven Zip entry instance

createEntry(String name, InputStream source, SevenZipEntrySettings newEntrySettings, File file)

public final SevenZipArchiveEntry createEntry(String name, InputStream source, SevenZipEntrySettings newEntrySettings, File file)

Create single entry within the archive.

Compose archive with LZMA compressed encrypted entry.


     try (FileOutputStream sevenZipFile = new FileOutputStream("archive.7z")) {
         try (SevenZipArchive archive = new SevenZipArchive()) {
             archive.createEntry("entry1.bin", new ByteArrayInputStream(new byte[] {0x00, (byte)0xFF}), new SevenZipEntrySettings(new SevenZipLZMACompressionSettings(), new SevenZipAESEncryptionSettings("test1")), new File("data1.bin"));
             archive.save(sevenZipFile);
         }
     } catch (IOException ex) {
     }
 

The entry name is solely set within name parameter. The file name provided in file parameter does not affect the entry name.

file can refer to directory.

Parameters:

ParameterTypeDescription
namejava.lang.Stringthe name of the entry
sourcejava.io.InputStreamthe input stream for the entry
newEntrySettingsSevenZipEntrySettingscompression and encryption settings used for added SevenZipArchiveEntry item
filejava.io.Filethe metadata of file or folder to be compressed

Returns: SevenZipArchiveEntry - Seven Zip entry instance

createEntry(String name, String path)

public final SevenZipArchiveEntry createEntry(String name, String path)

Create single entry within the archive.


     try (FileOutputStream sevenZipFile = new FileOutputStream("archive.7z")) {
         try (SevenZipArchive archive = new SevenZipArchive(new SevenZipEntrySettings(new SevenZipLZMACompressionSettings()))) {
             archive.createEntry("data.bin", "file.dat");
             archive.save(sevenZipFile);
         }
     } catch (IOException ex) {
     }
 

The entry name is solely set within name parameter. The file name provided in path parameter does not affect the entry name.

Parameters:

ParameterTypeDescription
namejava.lang.Stringthe name of the entry
pathjava.lang.Stringthe fully qualified name of the new file, or the relative file name to be compressed

Returns: SevenZipArchiveEntry - Seven Zip entry instance

createEntry(String name, String path, boolean openImmediately)

public final SevenZipArchiveEntry createEntry(String name, String path, boolean openImmediately)

Create single entry within the archive.


     try (FileOutputStream sevenZipFile = new FileOutputStream("archive.7z")) {
         try (SevenZipArchive archive = new SevenZipArchive(new SevenZipEntrySettings(new SevenZipLZMACompressionSettings()))) {
             archive.createEntry("data.bin", "file.dat");
             archive.save(sevenZipFile);
         }
     } catch (IOException ex) {
     }
 

The entry name is solely set within name parameter. The file name provided in path parameter does not affect the entry name.

If the file is opened immediately with openImmediately parameter it becomes blocked until archive is saved.

Parameters:

ParameterTypeDescription
namejava.lang.Stringthe name of the entry
pathjava.lang.Stringthe fully qualified name of the new file, or the relative file name to be compressed
openImmediatelybooleantrue if open the file immediately, otherwise open the file on archive saving

Returns: SevenZipArchiveEntry - Seven Zip entry instance

createEntry(String name, String path, boolean openImmediately, SevenZipEntrySettings newEntrySettings)

public final SevenZipArchiveEntry createEntry(String name, String path, boolean openImmediately, SevenZipEntrySettings newEntrySettings)

Create single entry within the archive.


     try (FileOutputStream sevenZipFile = new FileOutputStream("archive.7z")) {
         try (SevenZipArchive archive = new SevenZipArchive(new SevenZipEntrySettings(new SevenZipLZMACompressionSettings()))) {
             archive.createEntry("data.bin", "file.dat");
             archive.save(sevenZipFile);
         }
     } catch (IOException ex) {
     }
 

The entry name is solely set within name parameter. The file name provided in path parameter does not affect the entry name.

If the file is opened immediately with openImmediately parameter it becomes blocked until archive is saved.

Parameters:

ParameterTypeDescription
namejava.lang.Stringthe name of the entry
pathjava.lang.Stringthe fully qualified name of the new file, or the relative file name to be compressed
openImmediatelybooleantrue if open the file immediately, otherwise open the file on archive saving
newEntrySettingsSevenZipEntrySettingscompression and encryption settings used for added SevenZipArchiveEntry item

Returns: SevenZipArchiveEntry - Zip entry instance

dispose()

public final void dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

extractToDirectory(String destinationDirectory)

public final void extractToDirectory(String destinationDirectory)

Extracts all the files in the archive to the directory provided.


     try (SevenZipArchive archive = new SevenZipArchive("archive.7z")) {
         archive.extractToDirectory("C:\\extracted");
     }
 

Parameters:

ParameterTypeDescription
destinationDirectoryjava.lang.Stringthe path to the directory to place the extracted files in.

If the directory does not exist, it will be created |

extractToDirectory(String destinationDirectory, String password)

public final void extractToDirectory(String destinationDirectory, String password)

Extracts all the files in the archive to the directory provided.


     try (SevenZipArchive archive = new SevenZipArchive("archive.7z")) {
         archive.extractToDirectory("C:\\extracted");
     }
 

Parameters:

ParameterTypeDescription
destinationDirectoryjava.lang.Stringthe path to the directory to place the extracted files in

If the directory does not exist, it will be created. | | password | java.lang.String | optional password for content decryption.

password is used for content decryption only. If file names are encrypted provide password in SevenZipArchive(String, String) or SevenZipArchive(java.io.InputStream, String) constructor. |

getEntries()

public final List<SevenZipArchiveEntry> getEntries()

Gets entries of SevenZipArchiveEntry type constituting the archive.

Returns: java.util.List<com.aspose.zip.SevenZipArchiveEntry> - entries of SevenZipArchiveEntry type constituting the archive

getFileEntries()

public final Iterable<IArchiveFileEntry> getFileEntries()

Gets entries of IArchiveFileEntry type constituting the 7z archive.

Returns: java.lang.Iterable<com.aspose.zip.IArchiveFileEntry> - entries of IArchiveFileEntry type constituting the 7z archive

getNewEntrySettings()

public final SevenZipEntrySettings getNewEntrySettings()

Compression and encryption settings used for newly added SevenZipArchiveEntry items.

Returns: SevenZipEntrySettings - compression and encryption settings used for newly added SevenZipArchiveEntry items

save(OutputStream output)

public final void save(OutputStream output)

Saves 7z archive to the stream provided.


     try (FileOutputStream sevenZipFile = new FileOutputStream("archive.7z")) {
         try (FileInputStream source = new FileInputStream("data.bin")) {
             try (SevenZipArchive archive = new SevenZipArchive()) {
                 archive.createEntry("data", source);
                 archive.save(sevenZipFile);
             }
         }
     } catch (IOException ex) {
     }
 

Parameters:

ParameterTypeDescription
outputjava.io.OutputStreamdestination stream

save(String destinationFileName)

public final void save(String destinationFileName)

Saves archive to destination file provided.


     try (FileInputStream source = new FileInputStream("data.bin")) {
         try (SevenZipArchive archive = new SevenZipArchive(new SevenZipEntrySettings(new SevenZipLZMACompressionSettings()))) {
             archive.createEntry("data", source);
             archive.save("archive.7z");
         }
     } catch (IOException ex) {
     }
 

Parameters:

ParameterTypeDescription
destinationFileNamejava.lang.Stringthe path of the archive to be created. If the specified file name points to an existing file, it will be overwritten.

It is possible to save an archive to the same path as it was loaded from. However, this is not recommended because this approach uses copying to temporary file. |

saveSplit(String destinationDirectory, SplitSevenZipArchiveSaveOptions options)

public final void saveSplit(String destinationDirectory, SplitSevenZipArchiveSaveOptions options)

Saves multi-volume archive to destination directory provided.


     try (SevenZipArchive archive = new SevenZipArchive()) {
         archive.createEntry("entry.bin", "data.bin");
         archive.saveSplit("C:\\Folder", new SplitSevenZipArchiveSaveOptions("volume", 65536));
     }
 

This method compose several (n) files filename.7z.001, filename.7z.002, …, filename.7z.(n).

Can not make existing archive multi-volume.

Parameters:

ParameterTypeDescription
destinationDirectoryjava.lang.Stringthe path to the directory where archive segments to be created
optionsSplitSevenZipArchiveSaveOptionsoptions for archive saving, including file name