Top Description Fields Constructors Methods
org.tukaani.xz

public Class DeltaInputStream

extends InputStream
Class Inheritance
Imports
java.io.InputStream, .IOException, org.tukaani.xz.delta.DeltaDecoder

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

Modifier and TypeField and Description
private final DeltaDecoder
public static final int
DISTANCE_MAX

Largest supported delta calculation distance.

public static final int
DISTANCE_MIN

Smallest supported delta calculation distance.

private IOException
private InputStream
private final byte[]

Constructor Summary

AccessConstructor and Description
public
DeltaInputStream(InputStream
input stream from which Delta filtered data is read
in
,
int
delta calculation distance, must be in the range [DISTANCE_MIN, DISTANCE_MAX]
distance
)

Creates a new Delta decoder with the given delta calculation distance.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the value returned by in.available()
available
()

Overrides java.io.InputStream.available.

Calls in.available().
public void
close()

Overrides java.io.InputStream.close.

Implements java.io.Closeable.close.

Closes the stream and calls in.close().
public int

Returns:

the next decoded byte, or -1 to indicate the end of input on the input stream in
read
()

Implements abstract java.io.InputStream.read.

Decode the next byte from this input stream.
public int

Returns:

number of bytes read, or -1 to indicate the end of the input stream in
read
(byte[]
target buffer for decoded data
buf
,
int
start offset in buf
off
,
int
maximum number of bytes to read
len
)

Overrides java.io.InputStream.read.

Decode into an array of bytes.
Inherited from java.io.InputStream:
markmarkSupportednullInputStreamreadreadAllBytesreadNBytesreadNBytesresetskipskipNBytestransferTo

Field Detail

deltaback to summary
private final DeltaDecoder delta
DISTANCE_MAXback to summary
public static final int DISTANCE_MAX

Largest supported delta calculation distance.

DISTANCE_MINback to summary
public static final int DISTANCE_MIN

Smallest supported delta calculation distance.

exceptionback to summary
private IOException exception
inback to summary
private InputStream in
tempBufback to summary
private final byte[] tempBuf

Constructor Detail

DeltaInputStreamback to summary
public DeltaInputStream(InputStream in, int distance)

Creates a new Delta decoder with the given delta calculation distance.

Parameters
in:InputStream

input stream from which Delta filtered data is read

distance:int

delta calculation distance, must be in the range [DISTANCE_MIN, DISTANCE_MAX]

Method Detail

availableback to summary
public int available() throws IOException

Overrides java.io.InputStream.available.

Calls in.available().

Returns:int

the value returned by in.available()

Exceptions
IOException:

Doc from java.io.InputStream.available.

if an I/O error occurs.

closeback to summary
public void close() throws IOException

Overrides java.io.InputStream.close.

Implements java.io.Closeable.close.

Closes the stream and calls in.close(). If the stream was already closed, this does nothing.

Exceptions
IOException:
if thrown by in.close()
readback to summary
public int read() throws IOException

Implements abstract java.io.InputStream.read.

Decode the next byte from this input stream.

Returns:int

the next decoded byte, or -1 to indicate the end of input on the input stream in

Exceptions
IOException:
may be thrown by in
readback to summary
public int read(byte[] buf, int off, int len) throws IOException

Overrides java.io.InputStream.read.

Decode into an array of bytes.

This calls in.read(buf, off, len) and defilters the returned data.

Parameters
buf:byte[]

target buffer for decoded data

off:int

start offset in buf

len:int

maximum number of bytes to read

Returns:int

number of bytes read, or -1 to indicate the end of the input stream in

Exceptions
IOException:
may be thrown by underlaying input stream in
XZIOException:
if the stream has been closed