LzmaArchiveSettings
Inheritance: java.lang.Object
public class LzmaArchiveSettings
Settings for lzma archive.
The Lempel\u2013Ziv\u2013Markov chain algorithm (LZMA) is an algorithm used to perform lossless data compression. This algorithm uses a dictionary compression scheme somewhat similar to the LZ77 algorithm and features a high compression ratio and a variable compression-dictionary size.
See more: Lempel\u2013Ziv\u2013Markov chain algorithm
Constructors
Constructor | Description |
---|---|
LzmaArchiveSettings() | Initializes a new instance of the LzmaArchiveSettings class with default dictionary size, equals to 16 megabytes. |
Methods
Method | Description |
---|---|
getCompressionProgressed() | Gets an event that is raised when a portion of raw stream compressed. |
getDictionarySize() | Dictionary (history buffer) size indicates how many bytes of the recently processed uncompressed data is kept in memory. |
setCompressionProgressed(Event<ProgressEventArgs> value) | Sets an event that is raised when a portion of raw stream compressed. |
setDictionarySize(int value) | Dictionary (history buffer) size indicates how many bytes of the recently processed uncompressed data is kept in memory. |
LzmaArchiveSettings()
public LzmaArchiveSettings()
Initializes a new instance of the LzmaArchiveSettings class with default dictionary size, equals to 16 megabytes.
LzmaArchiveSettings settings = new LzmaArchiveSettings();
settings.setDictionarySize(1048576);
try (LzmaArchive archive = new LzmaArchive(settings)) {
archive.setSource("data.bin");
archive.save(lzmaFile);
}
getCompressionProgressed()
public Event<ProgressEventArgs> getCompressionProgressed()
Gets an event that is raised when a portion of raw stream compressed.
lzmaArchiveSettings.setCompressionProgressed(new Event<ProgressEventArgs>() {
public void invoke(Object sender, ProgressEventArgs progressEventArgs) {
int percent = (int) ((100 * (long) progressEventArgs.getProceededBytes()) / entrySourceFile.length());
}
});
Returns: Event - an event that is raised when a portion of raw stream compressed
getDictionarySize()
public final int getDictionarySize()
Dictionary (history buffer) size indicates how many bytes of the recently processed uncompressed data is kept in memory. If not set, will be chosen accordingly to entry size.
The bigger the dictionary, the better the compression ratio usually is, but dictionaries bigger than the uncompressed data are waste of RAM.
Returns: int - Dictionary (history buffer) size.
setCompressionProgressed(Event<ProgressEventArgs> value)
public void setCompressionProgressed(Event<ProgressEventArgs> value)
Sets an event that is raised when a portion of raw stream compressed.
lzmaArchiveSettings.setCompressionProgressed(new Event<ProgressEventArgs>() {
public void invoke(Object sender, ProgressEventArgs progressEventArgs) {
int percent = (int) ((100 * (long) progressEventArgs.getProceededBytes()) / entrySourceFile.length());
}
});
Parameters:
Parameter | Type | Description |
---|---|---|
value | com.aspose.zip.Event<com.aspose.zip.ProgressEventArgs> | an event that is raised when a portion of raw stream compressed |
setDictionarySize(int value)
public final void setDictionarySize(int value)
Dictionary (history buffer) size indicates how many bytes of the recently processed uncompressed data is kept in memory. If not set, will be chosen accordingly to entry size.
The bigger the dictionary, the better the compression ratio usually is, but dictionaries bigger than the uncompressed data are waste of RAM.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int | Dictionary (history buffer) size. |