Maven module :un.storage : archive-xz :
Class : un.storage.archive.xz.SeekableInputStream
Extends/Implements : java.io.InputStream
Subclasses : -

Input stream with random access support.


Variables : -
Functions : skip, length, position, seek




Seeks 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
{@link java.io.InputStream#skip(long) InputStream.skip}.

@return 0 if n is negative,
less than n if skipping n
bytes would seek past the end of the file,
n otherwise

@throws IOException might be thrown by {@link #seek(long)}

public long skip (long n)


Gets the size of the stream.
public long length ()


Gets the current position in the stream.
public long position ()


Seeks to the specified absolute position in the stream.


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.

@param pos new read position in the stream

@throws IOException if pos is negative or if
a stream-specific I/O error occurs

public void seek (long pos)