bundles/org.tukani.xz/src/org/tukaani/xz/SeekableInputStream.java
public long skip(long n) throws IOException {
        if (n <= 0)
            return 0;

        long size = length();
        long pos = position();
        if (pos >= size)
            return 0;

        if (size - pos < n)
            n = size - pos;

        seek(pos + n);
        return n;
    }
public long skip(long n) throws IOException {
        if (n <= 0)
            return 0;

        long size = length();
        long pos = position();
        if (pos >= size)
            return 0;

        if (size - pos < n)
            n = size - pos;

        seek(pos + n);
        return n;
    }
public long skip ( long n ) throws IOException { if ( n <= 0 ) return 0 ; long size = length ( ) ; long pos = position ( ) ; if ( pos >= size ) return 0 ; if ( size - pos < n ) n = size - pos ; seek ( pos + n ) ; return n ; }
Seeks <code>n</code> bytes forward in this stream.
<p>
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 <code>0</code>. Otherwise, if skipping <code>n</code> bytes
would cause the position to exceed the stream size, this will do
equivalent of <code>seek(length())</code> and the return value will
be adjusted accordingly.
<p>
If <code>n</code> is negative, the position isn't changed and
the return value is <code>0</code>. It doesn't seek backward
because it would conflict with the specification of
{@link java.io.InputStream#skip(long) InputStream.skip}.

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

@throws      IOException might be thrown by {@link #seek(long)}
Seeks <code > n< / code > bytes forward in this stream . <p > 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 <code > 0< / code > . Otherwise if skipping <code > n< / code > bytes would cause the position to exceed the stream size this will do equivalent of <code > seek ( length () ) < / code > and the return value will be adjusted accordingly . <p > If <code > n< / code > is negative the position isn t changed and the return value is <code > 0< / code > . It doesn t seek backward because it would conflict with the specification of { @link java . io . InputStream#skip ( long ) InputStream . skip } .