|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
org.tukaani.xz.SeekableInputStream
public abstract class SeekableInputStream
Input stream with random access support.
Constructor Summary | |
---|---|
SeekableInputStream()
|
Method Summary | |
---|---|
abstract long |
length()
Gets the size of the stream. |
abstract long |
position()
Gets the current position in the stream. |
abstract void |
seek(long pos)
Seeks to the specified absolute position in the stream. |
long |
skip(long n)
Seeks n bytes forward in this stream. |
Methods inherited from class java.io.InputStream |
---|
available, close, mark, markSupported, read, read, read, reset |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SeekableInputStream()
Method Detail |
---|
public long skip(long n) throws java.io.IOException
n
bytes forward in this stream.
This will not seek past the end of the file. If the current position
is already at or past the end of the file, this doesn't seek at all
and returns 0
. Otherwise, if skipping n
bytes
would cause the position to exceed the stream size, this will do
equivalent of seek(length())
and the return value will
be adjusted accordingly.
If n
is negative, the position isn't changed and
the return value is 0
. It doesn't seek backward
because it would conflict with the specification of
InputStream.skip
.
skip
in class java.io.InputStream
0
if n
is negative,
less than n
if skipping n
bytes would seek past the end of the file,
n
otherwise
java.io.IOException
- might be thrown by seek(long)
public abstract long length() throws java.io.IOException
java.io.IOException
public abstract long position() throws java.io.IOException
java.io.IOException
public abstract void seek(long pos) throws java.io.IOException
Seeking past the end of the file should be supported by the subclasses
unless there is a good reason to do otherwise. If one has seeked
past the end of the stream, read
will return
-1
to indicate end of stream.
pos
- new read position in the stream
java.io.IOException
- if pos
is negative or if
a stream-specific I/O error occurs
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |