LZMA allows dictionaries up to one byte less than 4 GiB. This
implementation supports only 16 bytes less than 2 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.
0,
DICT_SIZE_MAX]
dictSize is outside
0,
DICT_SIZE_MAX]
propsByte is invalid
0,
DICT_SIZE_MAX]
BufferedInputStream, see the
in
BufferedInputStream, see the
-1 to impose no
in
in.
The caller needs to know if the "end of payload marker (EOPM)" alias
"end of stream marker (EOS marker)" alias "end marker" present.
If the end marker isn't used, the caller must know the exact
uncompressed size of the stream.
The caller also needs to provide the LZMA properties byte that encodes
the number of literal context bits (lc), literal position bits (lp),
and position bits (pb).
The dictionary size used when compressing is also needed. 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.
@param in input stream from which compressed
data is read
@param uncompSize uncompressed size of the LZMA stream or -1
if the end marker is used in the LZMA stream
@param propsByte LZMA properties byte that has the encoded
values for literal context bits (lc), literal
position bits (lp), and position bits (pb)
@param dictSize dictionary size as bytes, must be in the range
[0, DICT_SIZE_MAX]
@throws CorruptedInputException
if propsByte is invalid or
the first input byte is not 0x00
@throws UnsupportedOptionsException
dictionary size or uncompressed size is too
big for this implementation
in optionally with a preset dictionary.
0, DICT_SIZE_MAX]
null
propsByte is invalid or
in
in optionally with a preset dictionary.
0, DICT_SIZE_MAX]
null
in
Reading lots of data with read() from this input stream
may be inefficient. Wrap it in java.io.BufferedInputStream
if you need to read lots of data one byte at a time.
@return the next decompressed byte, or -1
to indicate the end of the compressed stream
@throws CorruptedInputException
@throws XZIOException if the stream has been closed
@throws EOFException
compressed input is truncated or corrupt
@throws IOException may be thrown by in
If len is zero, no bytes are read and 0
is returned. Otherwise this will block until len
bytes have been decompressed, the end of the LZMA stream is reached,
or an exception is thrown.
@param buf target buffer for uncompressed data
@param off start offset in buf
@param len maximum number of uncompressed bytes to read
@return number of bytes read, or -1 to indicate
the end of the compressed stream
@throws CorruptedInputException
@throws XZIOException if the stream has been closed
@throws EOFException compressed input is truncated or corrupt
@throws IOException may be thrown by in
in.close().in.close()
IMPORTANT: In contrast to other classes in this package, this class
reads data from its input stream one byte at a time. If the input stream
is for example {@link java.io.FileInputStream}, wrapping it into
{@link java.io.BufferedInputStream} tends to improve performance a lot.
This is not automatically done by this class because there may be use
cases where it is desired that this class won't read any bytes past
the end of the LZMA stream.
Even when using
BufferedInputStream, the performance tendsto be worse (maybe 10-20 % slower) than with {@link LZMA2InputStream}
or {@link XZInputStream} (when the .xz file contains LZMA2-compressed data).
@since 1.4