|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
org.at4j.comp.lzma.LzmaInputStream
public final class LzmaInputStream
This class provides an InputStream
for decoding data using
the Lempel-Ziv-Markov chain algorithm. It uses the LZMA decoder from the LZMA SDK.
The API from the LZMA SDK is built around a standalone decoder. To adapt that into the Java streams API, the decoder is launched in a separate execution thread. The decoder writes data to a blocking queue that this stream reads its data from.
Errors are propagated up from the decoder to the calling thread. If an error occurs in the decoder, it will be reported to the calling thread the next time that it tries to read from or close the stream.
Decoding a file consumes a lot of memory – up to the dictionary size set when encoding it multiplied with the decoder data queue depth plus one. (The default dictionary size is 2^23 = 8.4 MB and the default data queue depth is 1.)
By default, data in an LZMA stream has the following format:
LzmaInputStreamSettings
object that says which headers the stream can
expect to find.
LzmaInputStreamSettings
,
LzmaOutputStream
Constructor Summary | |
---|---|
LzmaInputStream(InputStream is)
Create a LZMA decoding stream using the default settings. |
|
LzmaInputStream(InputStream is,
LzmaInputStreamSettings settings)
Create a LZMA decoding stream using custom settings. |
Method Summary | |
---|---|
void |
close()
|
protected void |
finalize()
|
int |
read()
|
int |
read(byte[] barr)
|
int |
read(byte[] barr,
int off,
int len)
|
Methods inherited from class java.io.InputStream |
---|
available, mark, markSupported, reset, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LzmaInputStream(InputStream is)
is
- The stream containing LZMA encoded data. Since this stream is
read in a separate thread, a lock-aware stream such as one returned from
Files.openForRead(org.entityfs.ReadableFile)
cannot be used.LzmaInputStream(InputStream, LzmaInputStreamSettings)
,
LzmaInputStreamSettings
public LzmaInputStream(InputStream is, LzmaInputStreamSettings settings) throws IllegalArgumentException
is
- The stream containing LZMA encoded data. Since this stream is
read in a separate thread, a lock-aware stream such as one returned from
Files.openForRead(org.entityfs.ReadableFile)
cannot be used.settings
- The compression settings that were used when writing the
compressed data.
IllegalArgumentException
- If the uncompressed size is less than
-1.Method Detail |
---|
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] barr) throws IOException
read
in class InputStream
IOException
public int read(byte[] barr, int off, int len) throws IOException
read
in class InputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in class InputStream
IOException
protected void finalize() throws Throwable
finalize
in class Object
Throwable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |