|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.at4j.comp.lzma.LzmaOutputStreamSettings
public class LzmaOutputStreamSettings
This configuration object contains settings for the LzmaOutputStream
.
When new:ed, this object contains the default settings. Use setter methods to
modify its properties.
The properties are documented by their setter methods. For more in-depth documentation, refer to the LZMA SDK documentation.
LzmaOutputStream
Field Summary | |
---|---|
static int |
DEFAULT_DICTIONARY_SIZE_EXPONENT
The default dictionary size exponent. |
static MatchFinderAlgorithm |
DEFAULT_MATCH_FINDER_ALGORITHM
The default match finder algorithm. |
static int |
DEFAULT_MAX_DATA_QUEUE_SIZE
The default maximum number of entries in the data queue used to feed data to the encoder. |
static int |
DEFAULT_NUMBER_OF_LITERAL_CONTEXT_BITS
The default number of literal context bits. |
static int |
DEFAULT_NUMBER_OF_LITERAL_POS_BITS
The default number of literal pos bits. |
static int |
DEFAULT_NUMBER_OF_POS_BITS
The default number of pos bits. |
static boolean |
DEFAULT_WRITE_STREAM_PROPERTIES
By default the stream properties are written at the head of the stream. |
static boolean |
DEFAULT_WRITE_UNCOMPRESSED_DATA_SIZE
By default the size of uncompressed data is written after the stream properties at the head of the stream. |
Constructor Summary | |
---|---|
LzmaOutputStreamSettings()
|
Method Summary | |
---|---|
int |
getBufferSize()
Get the buffer size to use for the buffered output stream that the LZMA stream is opened on. |
int |
getDictionarySizeExponent()
Get the dictionary size exponent. |
MatchFinderAlgorithm |
getMatchFinderAlgorithm()
Get the match finder algorithm for the encoder. |
int |
getMaxDataQueueSize()
Get the maximum size for the data queue used to feed data to the encoder. |
int |
getNumberOfLiteralContextBits()
Get the number of literal context bits. |
int |
getNumberOfLiteralPosBits()
Get the number of literal pos bits. |
int |
getNumberOfPosBits()
Get the number of pos bits. |
byte[] |
getProperties()
This method can be used to get the output stream properties in the format that they are encoded in the stream. |
ThreadFactory |
getThreadFactory()
Get the thread factory that will be used for creating the LZMA compression thread. |
boolean |
isWriteStreamProperties()
Should the encoder properties be written at the head of the stream? |
boolean |
isWriteUncompressedDataSize()
Should the uncompressed data size (even if unknown) be written after the encoder properties at the head of the stream? |
LzmaOutputStreamSettings |
setBufferSize(int sz)
Set the buffer size to use for the buffered output stream that the LZMA stream is opened on. |
LzmaOutputStreamSettings |
setCompressionLevel(CompressionLevel level)
Set a compression level. |
LzmaOutputStreamSettings |
setDictionarySizeExponent(int size)
Set the dictionary size exponent. |
LzmaOutputStreamSettings |
setMatchFinderAlgorithm(MatchFinderAlgorithm mfa)
Set the match finder algorithm for the encoder. |
LzmaOutputStreamSettings |
setMaxDataQueueSize(int max)
Set the maximum queue depth for the data queue used to feed data to the encoder. |
LzmaOutputStreamSettings |
setNumberOfLiteralContextBits(int no)
Set the number of literal context bits. |
LzmaOutputStreamSettings |
setNumberOfLiteralPosBits(int no)
Set the number of literal pos bits. |
LzmaOutputStreamSettings |
setNumberOfPosBits(int no)
Set the number of pos bits. |
LzmaOutputStreamSettings |
setThreadFactory(ThreadFactory tf)
Set the thread factory to use for creating the thread that will run the LZMA compression. |
LzmaOutputStreamSettings |
setWriteStreamProperties(boolean b)
Should the encoding properties be written at the head of the stream? The properties are five bytes that document the settings of the encoder when encoding the stream. |
LzmaOutputStreamSettings |
setWriteUncompressedDataSize(boolean b)
Should the uncompressed data size be written at the head of the stream, after the encoder properties (or first, if they are not present)? The uncompressed data size is a eight byte signed little endian value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_DICTIONARY_SIZE_EXPONENT
setDictionarySizeExponent(int)
.
public static final int DEFAULT_NUMBER_OF_LITERAL_CONTEXT_BITS
setNumberOfLiteralContextBits(int)
.
public static final int DEFAULT_NUMBER_OF_LITERAL_POS_BITS
setNumberOfLiteralPosBits(int)
.
public static final int DEFAULT_NUMBER_OF_POS_BITS
setNumberOfPosBits(int)
.
public static final MatchFinderAlgorithm DEFAULT_MATCH_FINDER_ALGORITHM
setMatchFinderAlgorithm(MatchFinderAlgorithm)
.
public static final int DEFAULT_MAX_DATA_QUEUE_SIZE
setMaxDataQueueSize(int)
.
public static final boolean DEFAULT_WRITE_STREAM_PROPERTIES
setWriteStreamProperties(boolean)
.
public static final boolean DEFAULT_WRITE_UNCOMPRESSED_DATA_SIZE
setWriteUncompressedDataSize(boolean)
.
Constructor Detail |
---|
public LzmaOutputStreamSettings()
Method Detail |
---|
public LzmaOutputStreamSettings setDictionarySizeExponent(int size) throws IllegalArgumentException
2^size
bytes. The maximum exponent is 30. The default is 2^23
= 8.4 MB.
size
- The dictionary size exponent.
this
IllegalArgumentException
- If the supplied size is negative or
larger than 30.public int getDictionarySizeExponent()
setDictionarySizeExponent(int)
public LzmaOutputStreamSettings setNumberOfLiteralContextBits(int no) throws IllegalArgumentException
This value must be between 0 and 8 (inclusive). The default value is 3. According to the LZMA documentation, 4 may give a better compress ratio for big files.
no
- The number of literal context bits.
this
IllegalArgumentException
- If the number is negative or greater
than 8.public int getNumberOfLiteralContextBits()
setNumberOfLiteralContextBits(int)
public LzmaOutputStreamSettings setNumberOfLiteralPosBits(int no) throws IllegalArgumentException
2^no
bytes. For example, for 32-bit (4
bytes) periodical data, no
can be set to 2.
If this property is modified from its default value of 0, it often makes
sense to set the number of literal context bits to 0. See
setNumberOfLiteralContextBits(int)
.
This property must be in the range between 0 and 4 (inclusive).
no
- The number of literal pos bits.
this
.
IllegalArgumentException
- If the number is negative or greater
than 4.public int getNumberOfLiteralPosBits()
setNumberOfLiteralPosBits(int)
public LzmaOutputStreamSettings setNumberOfPosBits(int no) throws IllegalArgumentException
2^no
.
This value must be between 0 and 4 (inclusive). The default value is 2.
no
- The number of pos bits.
this
IllegalArgumentException
- If the number is negative or greater
than 4.public int getNumberOfPosBits()
setNumberOfPosBits(int)
public LzmaOutputStreamSettings setMatchFinderAlgorithm(MatchFinderAlgorithm mfa) throws NullPointerException
mfa
- The match finder algorithm.
this
NullPointerException
- If the match finder algorithm is null
.public MatchFinderAlgorithm getMatchFinderAlgorithm()
setMatchFinderAlgorithm(MatchFinderAlgorithm)
public LzmaOutputStreamSettings setMaxDataQueueSize(int max) throws IllegalArgumentException
The queue depth is measured in the number of data records in the queue. Every time the writing thread writes to the LZMA output stream, a data entry is put on the queue. This may be a single byte or a large byte array.
max
- The maximum queue depth measured in the number of data
entries. 0 means that the queue has unlimited size.
this
IllegalArgumentException
- If the maximum queue depth is negative.public int getMaxDataQueueSize()
setMaxDataQueueSize(int)
public LzmaOutputStreamSettings setWriteStreamProperties(boolean b)
If the properties are set somewhere else, this may be set to false
.
The default behavior is to write the encoder properties.
b
- Should the encoding properties be written at the head of the
stream?
this
setWriteUncompressedDataSize(boolean)
public boolean isWriteStreamProperties()
true
if the encoder properties should be written at the
head of the stream.setWriteStreamProperties(boolean)
public LzmaOutputStreamSettings setWriteUncompressedDataSize(boolean b)
The default behavior is to write the uncompressed data size, or to write
-1
if that is unknown.
b
- Should the uncompressed data size be written at the head of the
stream?
this
public boolean isWriteUncompressedDataSize()
true
if the uncompressed data size should be written at
the head of the stream.setWriteUncompressedDataSize(boolean)
public LzmaOutputStreamSettings setBufferSize(int sz) throws IllegalArgumentException
sz
- The buffer size.
this
IllegalArgumentException
- If the buffer size is < 1
.public int getBufferSize()
setBufferSize(int)
public LzmaOutputStreamSettings setCompressionLevel(CompressionLevel level)
The following values are set for the different compression levels:
Property | BEST | DEFAULT | FASTEST |
Dictionary size exponent | 30 bytes | 23 bytes | 20 bytes |
Number of literal context bits | 4 | 3 | 3 |
level
- The compression level.
this
public LzmaOutputStreamSettings setThreadFactory(ThreadFactory tf)
If this is not set, the LzmaOutputStream
will just create a
thread with new Thread
.
By default, this property is null
.
tf
- The thread factory, or null
if the
LzmaOutputStream
should use new Thread
to create the
compression thread.
this
public ThreadFactory getThreadFactory()
null
if not set.public byte[] getProperties()
The properties can be used with a LzmaInputStreamSettings
object.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |