Package org.tukaani.xz
Class DeltaInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.tukaani.xz.DeltaInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class DeltaInputStream extends java.io.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 int
DISTANCE_MAX
Largest supported delta calculation distance.static int
DISTANCE_MIN
Smallest supported delta calculation distance.
-
Constructor Summary
Constructors Constructor Description DeltaInputStream(java.io.InputStream in, int distance)
Creates a new Delta decoder with the given delta calculation distance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
Callsin.available()
.void
close()
Closes the stream and callsin.close()
.int
read()
Decode the next byte from this input stream.int
read(byte[] buf, int off, int len)
Decode into an array of bytes.
-
-
-
Field Detail
-
DISTANCE_MIN
public static final int DISTANCE_MIN
Smallest supported delta calculation distance.- See Also:
- Constant Field Values
-
DISTANCE_MAX
public static final int DISTANCE_MAX
Largest supported delta calculation distance.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DeltaInputStream
public DeltaInputStream(java.io.InputStream in, int distance)
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 Detail
-
read
public int read() throws java.io.IOException
Decode the next byte from this input stream.- Specified by:
read
in classjava.io.InputStream
- Returns:
- the next decoded byte, or
-1
to indicate the end of input on the input streamin
- Throws:
java.io.IOException
- may be thrown byin
-
read
public int read(byte[] buf, int off, int len) throws java.io.IOException
Decode into an array of bytes.This calls
in.read(buf, off, len)
and defilters the returned data.- Overrides:
read
in classjava.io.InputStream
- Parameters:
buf
- target buffer for decoded dataoff
- start offset inbuf
len
- maximum number of bytes to read- Returns:
- number of bytes read, or
-1
to indicate the end of the input streamin
- Throws:
XZIOException
- if the stream has been closedjava.io.IOException
- may be thrown by underlaying input streamin
-
available
public int available() throws java.io.IOException
Callsin.available()
.- Overrides:
available
in classjava.io.InputStream
- Returns:
- the value returned by
in.available()
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
Closes the stream and callsin.close()
. If the stream was already closed, this does nothing.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.InputStream
- Throws:
java.io.IOException
- if thrown byin.close()
-
-