ParallelOptions

Inheritance: java.lang.Object

public class ParallelOptions

Options for parallel compression.


    try (Archive archive = new Archive()) {
        archive.createEntries("DirToCompress");
        ParallelOptions parallelOptions = new ParallelOptions();
        parallelOptions.setParallelCompressInMemory(mode);
        parallelOptions.setAvailableMemorySize(4000);
        ArchiveSaveOptions archiveSaveOptions = new ArchiveSaveOptions();
        archiveSaveOptions.setParallelOptions(parallelOptions);
        archive.save("archive.zip", archiveSaveOptions);
    }
 

These options manage simultaneous compression by several CPU cores.

Constructors

ConstructorDescription
ParallelOptions()

Methods

MethodDescription
getAvailableMemorySize()Gets memory estimate in megabytes available to accommodate compressed entries without swap to disk.
getParallelCompressInMemory()Gets value indicating how parallel approach to be used.
setAvailableMemorySize(int value)Sets memory estimate in megabytes available to accommodate compressed entries without swap to disk.
setParallelCompressInMemory(ParallelCompressionMode value)Sets value indicating how parallel approach to be used.

ParallelOptions()

public ParallelOptions()

getAvailableMemorySize()

public final int getAvailableMemorySize()

Gets memory estimate in megabytes available to accommodate compressed entries without swap to disk. This value only makes sense if getParallelCompressInMemory() setting is in ParallelCompressionMode.Auto mode.

This value is used to calculate biggest size of entry that can be compressed in parallel with others. All entries above the calculated threshold will be compressed sequentially. It is safe to have getAvailableMemorySize() property as big as free RAM and even bigger. By default it is assumed you have at least 200MB per CPU core.

Returns: int - memory estimate in megabytes

getParallelCompressInMemory()

public final ParallelCompressionMode getParallelCompressInMemory()

Gets value indicating how parallel approach to be used.

Returns: ParallelCompressionMode - value indicating how parallel approach to be used.

setAvailableMemorySize(int value)

public final void setAvailableMemorySize(int value)

Sets memory estimate in megabytes available to accommodate compressed entries without swap to disk. This value only makes sense if getParallelCompressInMemory() setting is in ParallelCompressionMode.Auto mode.

This value is used to calculate biggest size of entry that can be compressed in parallel with others. All entries above the calculated threshold will be compressed sequentially. It is safe to have getAvailableMemorySize() property as big as free RAM and even bigger. By default it is assumed you have at least 200MB per CPU core.

Parameters:

ParameterTypeDescription
valueintmemory estimate in megabytes

setParallelCompressInMemory(ParallelCompressionMode value)

public final void setParallelCompressInMemory(ParallelCompressionMode value)

Sets value indicating how parallel approach to be used.

Parameters:

ParameterTypeDescription
valueParallelCompressionModevalue indicating how parallel approach to be used.