Package org.tukaani.xz
Class DeltaInputStream
java.lang.Object
java.io.InputStream
org.tukaani.xz.DeltaInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
public class DeltaInputStream extends InputStream
Decodes raw Delta-filtered data (no XZ headers).
The delta filter doesn't change the size of the data and thus it cannot have an end-of-payload marker. It will simply decode until its input stream indicates end of input.
-
Field Summary
Fields Modifier and Type Field Description static intDISTANCE_MAXLargest supported delta calculation distance.static intDISTANCE_MINSmallest supported delta calculation distance. -
Constructor Summary
Constructors Constructor Description DeltaInputStream(InputStream in, int distance)Creates a new Delta decoder with the given delta calculation distance. -
Method Summary
Methods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Field Details
-
DISTANCE_MIN
public static final int DISTANCE_MINSmallest supported delta calculation distance.- See Also:
- Constant Field Values
-
DISTANCE_MAX
public static final int DISTANCE_MAXLargest supported delta calculation distance.- See Also:
- Constant Field Values
-
-
Constructor Details
-
DeltaInputStream
Creates a new Delta decoder with the given delta calculation distance.- Parameters:
in- input stream from which Delta filtered data is readdistance- delta calculation distance, must be in the range [DISTANCE_MIN,DISTANCE_MAX]
-
-
Method Details
-
read
Decode the next byte from this input stream.- Specified by:
readin classInputStream- Returns:
- the next decoded byte, or
-1to indicate the end of input on the input streamin - Throws:
IOException- may be thrown byin
-
read
Decode into an array of bytes.This calls
in.read(buf, off, len)and defilters the returned data.- Overrides:
readin classInputStream- Parameters:
buf- target buffer for decoded dataoff- start offset inbuflen- maximum number of bytes to read- Returns:
- number of bytes read, or
-1to indicate the end of the input streamin - Throws:
XZIOException- if the stream has been closedIOException- may be thrown by underlaying input streamin
-
available
Callsin.available().- Overrides:
availablein classInputStream- Returns:
- the value returned by
in.available() - Throws:
IOException
-
close
Closes the stream and callsin.close(). If the stream was already closed, this does nothing.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException- if thrown byin.close()
-