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.
getCloseEntrySource()Gets a value indicating whether entries’ sources should be closed right after an entry has been compressed.
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.
getSelfExtractorOptions()Gets settings for self extracted archive.
setArchiveComment(String value)Sets optional comment for the Zip file.
setCloseEntrySource(boolean value)Sets a value indicating whether entries’ sources should be closed right after an entry has been compressed.
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.
setSelfExtractorOptions(SelfExtractorOptions value)Sets settings for self extracted archive.

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.

getCloseEntrySource()

public final boolean getCloseEntrySource()

Gets a value indicating whether entries’ sources should be closed right after an entry has been compressed.

Returns: boolean - a value indicating whether entries’ sources should be closed right after an entry has been compressed

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.

getSelfExtractorOptions()

public final SelfExtractorOptions getSelfExtractorOptions()

Gets settings for self extracted archive.

Assign it if you need to compose executable program to extract an archive without any software installed on the target computer.

Returns: SelfExtractorOptions - settings for self extracted archive.

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.

setCloseEntrySource(boolean value)

public final void setCloseEntrySource(boolean value)

Sets a value indicating whether entries’ sources should be closed right after an entry has been compressed.

Parameters:

ParameterTypeDescription
valuebooleana value indicating whether entries’ sources should be closed right after an entry has been compressed

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.

setSelfExtractorOptions(SelfExtractorOptions value)

public final void setSelfExtractorOptions(SelfExtractorOptions value)

Sets settings for self extracted archive.

Assign it if you need to compose executable program to extract an archive without any software installed on the target computer.

Parameters:

ParameterTypeDescription
valueSelfExtractorOptionssettings for self extracted archive.