BufferedInputStream.skip

BufferedInputStream.skip

Class Overview | Class Members | This Package | All Packages

Syntax
public synchronized long skip( long n ) throws IOException
Parameters
n
the number of bytes to be skipped.
Returns
the actual number of bytes skipped.
Description
Skips over and discards n bytes of data from the input stream. The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly zero. The actual number of bytes skipped is returned.

The skip method of BufferedInputStream compares the number of bytes it has available in its buffer, k, where k = count - pos, with n. If n ≤ k, then the pos field is incremented by n. Otherwise, the pos field is incremented to have the value count, and the remaining bytes are skipped by calling the skip method on the underlying input stream, supplying the argument n - k.

Exceptions
IOException if an I/O error occurs.
Overrides
skip in class FilterInputStream