public class BZip2WritableFileSettings extends Object implements Cloneable
BZip2WritableFile
.Constructor and Description |
---|
BZip2WritableFileSettings() |
Modifier and Type | Method and Description |
---|---|
BZip2WritableFileSettings |
clone()
Make a copy of this object.
|
int |
getBlockSize() |
int |
getBufferSize() |
BZip2EncoderExecutorService |
getExcutorService() |
org.entityfs.support.log.LogAdapter |
getLogAdapter() |
int |
getNumberOfEncoderThreads() |
int |
getNumberOfHuffmanTreeRefinementIterations()
Get the number of Huffman tree refinement iterations.
|
BZip2OutputStreamSettings |
getOutputStreamSettings()
Get the settings for a
BZip2OutputStream based on the
configuration of this object. |
boolean |
isUseCommonsCompress() |
BZip2WritableFileSettings |
setBlockSize(int blockSize)
Set the block size for the compression.
|
BZip2WritableFileSettings |
setBufferSize(int bufferSize)
Set the buffer size used for the input buffer that may be used before
compressing written data.
|
BZip2WritableFileSettings |
setExecutorService(BZip2EncoderExecutorService executorService)
Set an executor service that will be used for spreading the work of
encoding bzip2 blocks over several threads.
|
BZip2WritableFileSettings |
setLogAdapter(org.entityfs.support.log.LogAdapter la)
Set a
LogAdapter to use for logging error and diagnostic output. |
BZip2WritableFileSettings |
setNumberOfEncoderThreads(int no)
Set the number of encoder threads to use for encoding bzip2 blocks.
|
BZip2WritableFileSettings |
setNumberOfHuffmanTreeRefinementIterations(int no)
Set the number of tree refinement iterations that is run when creating
Huffman trees for each compressed data block.
|
BZip2WritableFileSettings |
setUseCommonsCompress(boolean b)
Should the bzip2 implementation from Apache Commons Compress be used
instead of At4J's?
|
public BZip2WritableFileSettings setBlockSize(int blockSize) throws IllegalArgumentException
blockSize
- The size of bzip2 dictionary in 100k units. This must be
a value between 1
and 9
(inclusive). A higher value gives
a higher compression, but it will also make the compression and future
decompressions use more memory.this
IllegalArgumentException
- If the block size is not in the
permitted range.public int getBlockSize()
public BZip2WritableFileSettings setBufferSize(int bufferSize) throws IllegalArgumentException
By default, no buffer is used.
bufferSize
- The size of the memory buffer used for buffering the
written output before it is compressed. Set this to 0
to disable
the buffer.this
IllegalArgumentException
public int getBufferSize()
public BZip2WritableFileSettings setUseCommonsCompress(boolean b)
b
- Set this to true
to use the bzip2 implementation from
Commons Compress.this
public boolean isUseCommonsCompress()
public BZip2WritableFileSettings setLogAdapter(org.entityfs.support.log.LogAdapter la)
LogAdapter
to use for logging error and diagnostic output.
This is only used for logging error output if several encoder threads are
used.la
- The log adapter.this
public org.entityfs.support.log.LogAdapter getLogAdapter()
public BZip2WritableFileSettings setNumberOfEncoderThreads(int no) throws IllegalArgumentException
By default, bzip2 blocks are encoded in the thread that writes data to the writable file.
If an executor is set with the
setExecutorService(BZip2EncoderExecutorService)
method, this
property is ignored.
no
- Number of encoder threads. Set this to 0
to encode
bzip2 blocks in the thread writing to the writable file.this
IllegalArgumentException
- If the number is negative.public int getNumberOfEncoderThreads()
public BZip2WritableFileSettings setExecutorService(BZip2EncoderExecutorService executorService)
BZip2WritableFile
:s and/or
BZip2OutputStream
:s.
An executor service is created using the
BZip2OutputStream.createExecutorService()
or the
BZip2OutputStream.createExecutorService(int)
method.
executorService
- The executor service.this
public BZip2EncoderExecutorService getExcutorService()
public BZip2WritableFileSettings setNumberOfHuffmanTreeRefinementIterations(int no) throws IllegalArgumentException
A higher value for this parameter should give better but slower compression. As the value increases the returns are diminishing.
The default value is five refinement iterations.
no
- The number of Huffman tree refinement iterations. This should
be a positive integer larger than zero.this
IllegalArgumentException
- If the number is not a positive integer
larger than zero.public int getNumberOfHuffmanTreeRefinementIterations()
public BZip2OutputStreamSettings getOutputStreamSettings()
BZip2OutputStream
based on the
configuration of this object.public BZip2WritableFileSettings clone()