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.InputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
java.io.IOException
public long skip(long len) throws java.io.IOException
skip
in class java.io.InputStream
java.io.IOException
public int read(byte[] buf, int off, int len) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
Copyright © 2012. All Rights Reserved.