共用方式為


InputStream.Skip(Int64) Method

Definition

Skips over and discards n bytes of data from this input stream.

[Android.Runtime.Register("skip", "(J)J", "GetSkip_JHandler")]
public virtual long Skip (long n);
[<Android.Runtime.Register("skip", "(J)J", "GetSkip_JHandler")>]
abstract member Skip : int64 -> int64
override this.Skip : int64 -> int64

Parameters

n
Int64

the number of bytes to be skipped.

Returns

the actual number of bytes skipped which might be zero.

Attributes

Exceptions

if this stream is closed or another IOException occurs.

Remarks

Skips over and discards n bytes of data from this input stream. The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0. This may result from any of a number of conditions; reaching end of file before n bytes have been skipped is only one possibility. The actual number of bytes skipped is returned. If n is negative, the skip method for class InputStream always returns 0, and no bytes are skipped. Subclasses may handle the negative value differently.

The skip method implementation of this class creates a byte array and then repeatedly reads into it until n bytes have been read or the end of the stream has been reached. Subclasses are encouraged to provide a more efficient implementation of this method. For instance, the implementation may depend on the ability to seek.

Java documentation for java.io.InputStream.skip(long).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to