public abstract class DeltaStream
extends java.io.InputStream
Implementations must provide a means to access a stream for the base object.
This stream may be accessed multiple times, in order to randomly position it
to match the copy instructions. A DeltaStream performs an efficient
skip by only moving through the delta stream, making restarts of stacked
deltas reasonably efficient.
| Constructor and Description |
|---|
DeltaStream(java.io.InputStream deltaStream)
Construct a delta application stream, reading instructions.
|
public DeltaStream(java.io.InputStream deltaStream)
throws java.io.IOException
deltaStream - the stream to read delta instructions from.java.io.IOException - the delta instruction stream cannot be read, or is
inconsistent with the the base object information.protected abstract java.io.InputStream openBase()
throws java.io.IOException
The DeltaStream may close and reopen the base stream multiple
times if copy instructions use offsets out of order. This can occur if a
large block in the file was moved from near the top, to near the bottom.
In such cases the reopened stream is skipped to the target offset, so
skip(long) should be as efficient as possible.
java.io.IOException - the base object cannot be opened for reading.protected abstract long getBaseSize()
throws java.io.IOException
java.io.IOException - the length of the base cannot be determined.public long getSize()
public int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreamjava.io.IOExceptionpublic long skip(long len)
throws java.io.IOException
skip in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] buf,
int off,
int len)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionCopyright © 2012. All Rights Reserved.