Class OriginSeekInputStream
java.lang.Object
java.io.InputStream
org.archive.io.SeekInputStream
org.archive.io.OriginSeekInputStream
- All Implemented Interfaces:
RepositionableStream,Closeable,AutoCloseable
Alters the origin of some other SeekInputStream. This class allows you
to completely ignore everything in the underlying stream before a specified
position, the origin position.
With the exception of position() and position(long),
all of the methods in this class simply delegate to the underlying input
stream. The position methods adjust the position of the
underlying stream relative to the origin specified at construction time.
- Author:
- pjack
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.archive.io.SeekInputStream
mark, markSupported, resetMethods inherited from class java.io.InputStream
close
-
Constructor Details
-
OriginSeekInputStream
Constructor.- Parameters:
input- the underlying streamorigin- the origin position- Throws:
IOException- if an IO error occurs
-
-
Method Details
-
available
- Overrides:
availablein classInputStream- Throws:
IOException
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classInputStream- Throws:
IOException
-
position
Returns the position of the underlying stream relative to the origin.- Returns:
- the relative position
- Throws:
IOException- if an IO error occurs
-
position
Positions the underlying stream relative to the origin. In other words, this.position(0) resolves to input.position(origin), where input is underlying stream and origin is the origin specified at construction time.- Parameters:
p- the new position for this stream- Throws:
IOException- if an IO error occurs
-