ArchiveSaveOptions

Inheritance: java.lang.Object

public class ArchiveSaveOptions

Options for saving a zip archive.

Constructors

ConstructorDescription
ArchiveSaveOptions()

Methods

MethodDescription
getArchiveComment()Gets optional comment for the Zip file.
getEncoding()Gets encoding for converting file names and other strings to bytes.
getEncryptionOptions()Gets encryption settings for saving existing zip archive.
getEventsBag()Gets container of events raising on archive saving.
getParallelOptions()Gets settings for parallel compression.
setArchiveComment(String value)Sets optional comment for the Zip file.
setEncoding(Charset value)Sets encoding for converting file names and other strings to bytes.
setEncryptionOptions(EncryptionSettings value)Sets encryption settings for saving existing zip archive.
setEventsBag(EventsBag value)Sets container of events raising on archive saving.
setParallelOptions(ParallelOptions value)Sets settings for parallel compression.

ArchiveSaveOptions()

public ArchiveSaveOptions()

getArchiveComment()

public final String getArchiveComment()

Gets optional comment for the Zip file.

Returns: java.lang.String - optional comment for the Zip file.

getEncoding()

public final Charset getEncoding()

Gets encoding for converting file names and other strings to bytes.

If not set, code page 437 will be used.

Returns: java.nio.charset.Charset - encoding for converting file names and other strings to bytes.

getEncryptionOptions()

public final EncryptionSettings getEncryptionOptions()

Gets encryption settings for saving existing zip archive.


    try (Archive archive = new Archive("plain.zip")) {
        ArchiveSaveOptions options = new ArchiveSaveOptions();
        options.setEncryptionOptions(new AesEncryptionSettings("p@s$", EncryptionMethod.AES256));
        archive.save("encripted.zip", options);
    }
 

Do not use this options for regular composition of encrypted archive.

Returns: EncryptionSettings - encryption settings for saving existing zip archive.

getEventsBag()

public final EventsBag getEventsBag()

Gets container of events raising on archive saving.

Returns: EventsBag - container of events raising on archive saving.

getParallelOptions()

public final ParallelOptions getParallelOptions()

Gets settings for parallel compression.

Assign it if you want to utilize several CPU cores while compressing several archive entries.

Returns: ParallelOptions - settings for parallel compression.

setArchiveComment(String value)

public final void setArchiveComment(String value)

Sets optional comment for the Zip file.

Parameters:

ParameterTypeDescription
valuejava.lang.Stringoptional comment for the Zip file.

setEncoding(Charset value)

public final void setEncoding(Charset value)

Sets encoding for converting file names and other strings to bytes.

If not set, code page 437 will be used.

Parameters:

ParameterTypeDescription
valuejava.nio.charset.Charsetencoding for converting file names and other strings to bytes.

setEncryptionOptions(EncryptionSettings value)

public final void setEncryptionOptions(EncryptionSettings value)

Sets encryption settings for saving existing zip archive.


    try (Archive archive = new Archive("plain.zip")) {
        ArchiveSaveOptions options = new ArchiveSaveOptions();
        options.setEncryptionOptions(new AesEncryptionSettings("p@s$", EncryptionMethod.AES256));
        archive.save("encripted.zip", options);
    }
 

Do not use this options for regular composition of encrypted archive.

Parameters:

ParameterTypeDescription
valueEncryptionSettingsencryption settings for saving existing zip archive.

setEventsBag(EventsBag value)

public final void setEventsBag(EventsBag value)

Sets container of events raising on archive saving.

Parameters:

ParameterTypeDescription
valueEventsBagcontainer of events raising on archive saving.

setParallelOptions(ParallelOptions value)

public final void setParallelOptions(ParallelOptions value)

Sets settings for parallel compression.

Assign it if you want to utilize several CPU cores while compressing several archive entries.

Parameters:

ParameterTypeDescription
valueParallelOptionssettings for parallel compression.