| Modifier and Type | Field and Description |
|---|---|
| private final ArrayCache | |
| private static final int | |
| public static final int | DICT_SIZE_MAX
Largest dictionary size supported by this implementation. |
| public static final int | DICT_SIZE_MIN
Smallest valid LZMA2 dictionary size. |
| private boolean | |
| private IOException | |
| private DataInputStream | |
| private boolean | |
| private LZDecoder | |
| private LZMADecoder | |
| private boolean | |
| private boolean | |
| private RangeDecoderFromBuffer | |
| private final byte[] | |
| private int |
| Access | Constructor and Description |
|---|---|
| public | LZMA2InputStream(InputStream
input stream from which LZMA2-compressed
data is read in, int LZMA2 dictionary size as bytes, must be
in the range [ dictSize)DICT_SIZE_MIN,
DICT_SIZE_MAX]Creates a new input stream that decompresses raw LZMA2 data
from |
| public | LZMA2InputStream(InputStream
input stream from which LZMA2-compressed
data is read in, int LZMA2 dictionary size as bytes, must be
in the range [ dictSize, byte[] DICT_SIZE_MIN,
DICT_SIZE_MAX]preset dictionary or presetDict)null
to use no preset dictionaryCreates a new LZMA2 decompressor using a preset dictionary. |
| pack-priv | LZMA2InputStream(InputStream
input stream from which LZMA2-compressed
data is read in, int LZMA2 dictionary size as bytes, must be
in the range [ dictSize, byte[] DICT_SIZE_MIN,
DICT_SIZE_MAX]preset dictionary or presetDict, ArrayCache null
to use no preset dictionarycache to be used for allocating large arrays arrayCache)Creates a new LZMA2 decompressor using a preset dictionary and array cache. |
| Modifier and Type | Method and Description |
|---|---|
| public int | Returns: the number of uncompressed bytes that can be read without blockingOverrides java. |
| public void | close()
Overrides java. Implements java. in.close().
|
| private void | |
| private void | |
| private static int | |
| public static int | Returns: approximate memory requirements as kibibytes (KiB)LZMA2 dictionary size as bytes, must be
in the range [ dictSize)DICT_SIZE_MIN,
DICT_SIZE_MAX]Gets approximate decompressor memory requirements as kibibytes for the given dictionary size. |
| private void | |
| public int | Returns: the next decompressed byte, or-1
to indicate the end of the compressed streamImplements abstract java. |
| public int | Returns: number of bytes read, or-1 to indicate
the end of the compressed streamtarget buffer for uncompressed data buf, int start offset in off, int bufmaximum number of uncompressed bytes to read len)Overrides java. |
| arrayCache | back to summary |
|---|---|
| private final ArrayCache arrayCache | |
| COMPRESSED_SIZE_MAX | back to summary |
|---|---|
| private static final int COMPRESSED_SIZE_MAX | |
| DICT_SIZE_MAX | back to summary |
|---|---|
| public static final int DICT_SIZE_MAX Largest dictionary size supported by this implementation. The LZMA2 algorithm allows dictionaries up to one byte less than 4 GiB. This implementation supports only 16 bytes less than 2 GiB for raw LZMA2 streams, and for .xz files the maximum is 1.5 GiB. This limitation is due to Java using signed 32-bit integers for array indexing. The limitation shouldn't matter much in practice since so huge dictionaries are not normally used. | |
| DICT_SIZE_MIN | back to summary |
|---|---|
| public static final int DICT_SIZE_MIN Smallest valid LZMA2 dictionary size. Very tiny dictionaries would be a performance problem, so the minimum is 4 KiB. | |
| endReached | back to summary |
|---|---|
| private boolean endReached | |
| exception | back to summary |
|---|---|
| private IOException exception | |
| in | back to summary |
|---|---|
| private DataInputStream in | |
| isLZMAChunk | back to summary |
|---|---|
| private boolean isLZMAChunk | |
| lz | back to summary |
|---|---|
| private LZDecoder lz | |
| lzma | back to summary |
|---|---|
| private LZMADecoder lzma | |
| needDictReset | back to summary |
|---|---|
| private boolean needDictReset | |
| needProps | back to summary |
|---|---|
| private boolean needProps | |
| rc | back to summary |
|---|---|
| private RangeDecoderFromBuffer rc | |
| tempBuf | back to summary |
|---|---|
| private final byte[] tempBuf | |
| uncompressedSize | back to summary |
|---|---|
| private int uncompressedSize | |
| LZMA2InputStream | back to summary |
|---|---|
| public LZMA2InputStream(InputStream in, int dictSize) Creates a new input stream that decompresses raw LZMA2 data
from The caller needs to know the dictionary size used when compressing; the dictionary size isn't stored as part of a raw LZMA2 stream. Specifying a too small dictionary size will prevent decompressing the stream. Specifying a too big dictionary is waste of memory but decompression will work. There is no need to specify a dictionary bigger than the uncompressed size of the data even if a bigger dictionary was used when compressing. If you know the uncompressed size of the data, this might allow saving some memory.
| |
| LZMA2InputStream | back to summary |
|---|---|
| public LZMA2InputStream(InputStream in, int dictSize, byte[] presetDict) Creates a new LZMA2 decompressor using a preset dictionary.
This is like
| |
| LZMA2InputStream | back to summary |
|---|---|
| pack-priv LZMA2InputStream(InputStream in, int dictSize, byte[] presetDict, ArrayCache arrayCache) Creates a new LZMA2 decompressor using a preset dictionary and array cache.
This is like
| |
| available | back to summary |
|---|---|
| public int available() throws IOException Overrides java. Returns the number of uncompressed bytes that can be read
without blocking. The value is returned with an assumption
that the compressed input data will be valid. If the compressed
data is corrupt,
In LZMA2InputStream, the return value will be non-zero when the
decompressor is in the middle of an LZMA2 chunk. The return value
will then be the number of uncompressed bytes remaining from that
chunk. The return value can also be non-zero in the middle of
an uncompressed chunk, but then the return value depends also on
the
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides java. Implements java. Closes the stream and calls
| |
| decodeChunkHeader | back to summary |
|---|---|
| private void decodeChunkHeader() throws IOException | |
| decodeProps | back to summary |
|---|---|
| private void decodeProps() throws IOException | |
| getDictSize | back to summary |
|---|---|
| private static int getDictSize(int dictSize) | |
| getMemoryUsage | back to summary |
|---|---|
| public static int getMemoryUsage(int dictSize) Gets approximate decompressor memory requirements as kibibytes for the given dictionary size.
| |
| putArraysToCache | back to summary |
|---|---|
| private void putArraysToCache() | |
| read | back to summary |
|---|---|
| public int read() throws IOException Implements abstract java. Decompresses the next byte from this input stream.
Reading lots of data with
| |
| read | back to summary |
|---|---|
| public int read(byte[] buf, int off, int len) throws IOException Overrides java. Decompresses into an array of bytes.
If
| |