Unless you know what you are doing, don't use this class to decompress
standalone .xz files. For that purpose, use XZInputStream.
If you are decompressing complete XZ streams and your application knows
exactly how much uncompressed data there should be, it is good to try
reading one more byte by calling read() and checking
that it returns -1. This way the decompressor will parse the
file footers and verify the integrity checks, giving the caller more
confidence that the uncompressed data is valid.
XZInputStream
| Modifier and Type | Field and Description |
|---|---|
| private final ArrayCache | |
| private BlockInputStream | |
| private final Check | |
| private boolean | |
| private IOException | |
| private InputStream | |
| private final IndexHash | |
| private final int | |
| private final StreamFlags | |
| private final byte[] | |
| private final boolean |
| Access | Constructor and Description |
|---|---|
| public | SingleXZInputStream(InputStream
input stream from which XZ-compressed
data is read in)Creates a new XZ decompressor that decompresses exactly one
XZ Stream from |
| public | SingleXZInputStream(InputStream
input stream from which XZ-compressed
data is read in, ArrayCache cache to be used for allocating large arrays arrayCache)Creates a new XZ decompressor that decompresses exactly one
XZ Stream from |
| public | SingleXZInputStream(InputStream
input stream from which XZ-compressed
data is read in, int memory usage limit in kibibytes (KiB)
or memoryLimit)-1 to impose no
memory usage limitCreates a new XZ decompressor that decompresses exactly one
XZ Stream from |
| public | SingleXZInputStream(InputStream
input stream from which XZ-compressed
data is read in, int memory usage limit in kibibytes (KiB)
or memoryLimit, ArrayCache -1 to impose no
memory usage limitcache to be used for allocating large arrays arrayCache)Creates a new XZ decompressor that decompresses exactly one
XZ Stream from |
| public | SingleXZInputStream(InputStream
input stream from which XZ-compressed
data is read in, int memory usage limit in kibibytes (KiB)
or memoryLimit, boolean -1 to impose no
memory usage limitif verifyCheck)true, the integrity checks
will be verified; this should almost never
be set to falseCreates a new XZ decompressor that decompresses exactly one
XZ Stream from |
| public | SingleXZInputStream(InputStream
input stream from which XZ-compressed
data is read in, int memory usage limit in kibibytes (KiB)
or memoryLimit, boolean -1 to impose no
memory usage limitif verifyCheck, ArrayCache true, the integrity checks
will be verified; this should almost never
be set to falsecache to be used for allocating large arrays arrayCache)Creates a new XZ decompressor that decompresses exactly one
XZ Stream from |
| pack-priv | SingleXZInputStream(InputStream in, int memoryLimit, boolean verifyCheck, byte[] streamHeader, ArrayCache arrayCache)
|
| 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().
|
| public void | |
| public String | Returns: the name of the check specified in the XZ Stream HeaderGets the name of the integrity check used in this XZ Stream. |
| public int | Returns: the Check ID specified in the XZ Stream HeaderGets the ID of the integrity check used in this XZ Stream. |
| 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. |
| private static byte[] | |
| private void |
| arrayCache | back to summary |
|---|---|
| private final ArrayCache arrayCache | |
| blockDecoder | back to summary |
|---|---|
| private BlockInputStream blockDecoder | |
| check | back to summary |
|---|---|
| private final Check check | |
| endReached | back to summary |
|---|---|
| private boolean endReached | |
| exception | back to summary |
|---|---|
| private IOException exception | |
| in | back to summary |
|---|---|
| private InputStream in | |
| indexHash | back to summary |
|---|---|
| private final IndexHash indexHash | |
| memoryLimit | back to summary |
|---|---|
| private final int memoryLimit | |
| streamHeaderFlags | back to summary |
|---|---|
| private final StreamFlags streamHeaderFlags | |
| tempBuf | back to summary |
|---|---|
| private final byte[] tempBuf | |
| verifyCheck | back to summary |
|---|---|
| private final boolean verifyCheck | |
| SingleXZInputStream | back to summary |
|---|---|
| public SingleXZInputStream(InputStream in) throws IOException Creates a new XZ decompressor that decompresses exactly one
XZ Stream from
This constructor reads and parses the XZ Stream Header (12 bytes)
from
| |
| SingleXZInputStream | back to summary |
|---|---|
| public SingleXZInputStream(InputStream in, ArrayCache arrayCache) throws IOException Creates a new XZ decompressor that decompresses exactly one
XZ Stream from
This is identical to
| |
| SingleXZInputStream | back to summary |
|---|---|
| public SingleXZInputStream(InputStream in, int memoryLimit) throws IOException Creates a new XZ decompressor that decompresses exactly one
XZ Stream from
This is identical to
| |
| SingleXZInputStream | back to summary |
|---|---|
| public SingleXZInputStream(InputStream in, int memoryLimit, ArrayCache arrayCache) throws IOException Creates a new XZ decompressor that decompresses exactly one
XZ Stream from
This is identical to
| |
| SingleXZInputStream | back to summary |
|---|---|
| public SingleXZInputStream(InputStream in, int memoryLimit, boolean verifyCheck) throws IOException Creates a new XZ decompressor that decompresses exactly one
XZ Stream from
This is identical to Note that integrity check verification should almost never be disabled. Possible reasons to disable integrity check verification:
| |
| SingleXZInputStream | back to summary |
|---|---|
| public SingleXZInputStream(InputStream in, int memoryLimit, boolean verifyCheck, ArrayCache arrayCache) throws IOException Creates a new XZ decompressor that decompresses exactly one
XZ Stream from
This is identical to
| |
| SingleXZInputStream | back to summary |
|---|---|
| pack-priv SingleXZInputStream(InputStream in, int memoryLimit, boolean verifyCheck, byte[] streamHeader, ArrayCache arrayCache) throws IOException | |
| 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,
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides java. Implements java. Closes the stream and calls
This is equivalent to
| |
| close | back to summary |
|---|---|
| public void close(boolean closeInput) throws IOException Closes the stream and optionally calls
If you don't want to close the underlying
Note that if you successfully reach the end of the stream
(
| |
| getCheckName | back to summary |
|---|---|
| public String getCheckName() Gets the name of the integrity check used in this XZ Stream.
| |
| getCheckType | back to summary |
|---|---|
| public int getCheckType() Gets the ID of the integrity check used in this XZ Stream.
| |
| 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
| |
| readStreamHeader | back to summary |
|---|---|
| private static byte[] readStreamHeader(InputStream in) throws IOException Reads the Stream Header into a buffer. This is a helper function for the constructors. | |
| validateStreamFooter | back to summary |
|---|---|
| private void validateStreamFooter() throws IOException | |