Class SevenZipEntrySettings
- java.lang.Object
-
- com.aspose.zip.SevenZipEntrySettings
-
public class SevenZipEntrySettings extends Object
Settings used to compress or decompress 7z entries.
-
-
Constructor Summary
Constructors Constructor Description SevenZipEntrySettings()Initializes a new instance of theSevenZipEntrySettingsclass.SevenZipEntrySettings(SevenZipCompressionSettings compressionSettings)Initializes a new instance of theSevenZipEntrySettingsclass.SevenZipEntrySettings(SevenZipCompressionSettings compressionSettings, SevenZipEncryptionSettings encryptionSettings)Initializes a new instance of theSevenZipEntrySettingsclass.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleangetCompressHeader()Gets value indicating whether to compress archive header.SevenZipCompressionSettingsgetCompressionSettings()Gets settings for compression or decompression routine.SevenZipEncryptionSettingsgetEncryptionSettings()Gets settings for encryption or decryption.booleangetSolid()Gets value indicating whether to concatenate entries and treat them as a single data block.voidsetCompressHeader(boolean value)Sets value indicating whether to compress archive header.voidsetSolid(boolean value)Sets value indicating whether to concatenate entries and treat them as a single data block.
-
-
-
Constructor Detail
-
SevenZipEntrySettings
public SevenZipEntrySettings()
Initializes a new instance of the
SevenZipEntrySettingsclass.
-
SevenZipEntrySettings
public SevenZipEntrySettings(SevenZipCompressionSettings compressionSettings)
Initializes a new instance of the
SevenZipEntrySettingsclass.- Parameters:
compressionSettings- settings for compression. Pass null for default LZMA settings.Can be one of these:
-
SevenZipEntrySettings
public SevenZipEntrySettings(SevenZipCompressionSettings compressionSettings, SevenZipEncryptionSettings encryptionSettings)
Initializes a new instance of the
SevenZipEntrySettingsclass.- Parameters:
compressionSettings- settings for compression. Pass null for default LZMA settings.Can be one of these:
encryptionSettings- settings for encryption. Pass null if no need to encrypt or decrypt.Can be only one:
-
-
Method Detail
-
getCompressionSettings
public final SevenZipCompressionSettings getCompressionSettings()
Gets settings for compression or decompression routine.
- Returns:
- settings for compression or decompression routine
-
getEncryptionSettings
public final SevenZipEncryptionSettings getEncryptionSettings()
Gets settings for encryption or decryption. Settings of particular entry may vary.
The
SevenZipAESEncryptionSettingsis only option for 7z archives.- Returns:
- settings for encryption or decryption
-
getCompressHeader
public final boolean getCompressHeader()
Gets value indicating whether to compress archive header.
This setting is equivalent
-mhc=onswitch of 7-Zip tool. Currently, it is incompatible with header encryption.- Returns:
- value indicating whether to compress archive header
-
setCompressHeader
public final void setCompressHeader(boolean value)
Sets value indicating whether to compress archive header.
This setting is equivalent
-mhc=onswitch of 7-Zip tool. Currently, it is incompatible with header encryption.- Parameters:
value- a value indicating whether to compress archive header
-
getSolid
public final boolean getSolid()
Gets value indicating whether to concatenate entries and treat them as a single data block.
The following example shows how to compress a directory to solid 7z archive with LZMA2 compression without encryption.
try (FileOutputStream sevenZipFile = new FileOutputStream("archive.7z")) { SevenZipEntrySettings settings = new SevenZipEntrySettings(new SevenZipLZMACompressionSettings()); settings.setSolid(true); try (SevenZipArchive archive = new SevenZipArchive(settings)) { archive.createEntries("C:\\Documents"); archive.save(sevenZipFile); } } catch (IOException ex) { }Provide
SevenZipEntrySettingsfor solid 7z archive on archive instantiation.- Returns:
- value indicating whether to concatenate entries and treat them as a single data block.
-
setSolid
public final void setSolid(boolean value)
Sets value indicating whether to concatenate entries and treat them as a single data block.
The following example shows how to compress a directory to solid 7z archive with LZMA2 compression without encryption.
try (FileOutputStream sevenZipFile = new FileOutputStream("archive.7z")) { SevenZipEntrySettings settings = new SevenZipEntrySettings(new SevenZipLZMACompressionSettings()); settings.setSolid(true); try (SevenZipArchive archive = new SevenZipArchive(settings)) { archive.createEntries("C:\\Documents"); archive.save(sevenZipFile); } } catch (IOException ex) { }Provide
SevenZipEntrySettingsfor solid 7z archive on archive instantiation.- Parameters:
value- value indicating whether to concatenate entries and treat them as a single data block.
-
-