다음을 통해 공유


Buffer.Clear Method

Definition

Clears this buffer.

[Android.Runtime.Register("clear", "()Ljava/nio/Buffer;", "GetClearHandler")]
public virtual Java.Nio.Buffer? Clear ();
[<Android.Runtime.Register("clear", "()Ljava/nio/Buffer;", "GetClearHandler")>]
abstract member Clear : unit -> Java.Nio.Buffer
override this.Clear : unit -> Java.Nio.Buffer

Returns

This buffer

Attributes

Remarks

Clears this buffer. The position is set to zero, the limit is set to the capacity, and the mark is discarded.

Invoke this method before using a sequence of channel-read or put operations to fill this buffer. For example:

<blockquote>

buf.clear();     // Prepare buffer for reading
            in.read(buf);    // Read data

</blockquote>

This method does not actually erase the data in the buffer, but it is named as if it did because it will most often be used in situations in which that might as well be the case.

Java documentation for java.nio.Buffer.clear().

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