Partager via


Buffer.Slice Method

Definition

Overloads

Slice()

Creates a new buffer whose content is a shared subsequence of this buffer's content.

Slice(Int32, Int32)

Creates a new buffer whose content is a shared subsequence of this buffer's content.

Slice()

Creates a new buffer whose content is a shared subsequence of this buffer's content.

[Android.Runtime.Register("slice", "()Ljava/nio/Buffer;", "GetSliceHandler", ApiSince=34)]
public virtual Java.Nio.Buffer? Slice ();
[<Android.Runtime.Register("slice", "()Ljava/nio/Buffer;", "GetSliceHandler", ApiSince=34)>]
abstract member Slice : unit -> Java.Nio.Buffer
override this.Slice : unit -> Java.Nio.Buffer

Returns

The new buffer

Attributes

Remarks

Creates a new buffer whose content is a shared subsequence of this buffer's content.

The content of the new buffer will start at this buffer's current position. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position, limit, and mark values will be independent.

The new buffer's position will be zero, its capacity and its limit will be the number of elements remaining in this buffer, its mark will be undefined. The new buffer will be direct if, and only if, this buffer is direct, and it will be read-only if, and only if, this buffer is read-only.

Added in 9.

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

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

Slice(Int32, Int32)

Creates a new buffer whose content is a shared subsequence of this buffer's content.

[Android.Runtime.Register("slice", "(II)Ljava/nio/Buffer;", "GetSlice_IIHandler", ApiSince=34)]
public virtual Java.Nio.Buffer? Slice (int index, int length);
[<Android.Runtime.Register("slice", "(II)Ljava/nio/Buffer;", "GetSlice_IIHandler", ApiSince=34)>]
abstract member Slice : int * int -> Java.Nio.Buffer
override this.Slice : int * int -> Java.Nio.Buffer

Parameters

index
Int32

The position in this buffer at which the content of the new buffer will start; must be non-negative and no larger than #limit() limit()

length
Int32

The number of elements the new buffer will contain; must be non-negative and no larger than limit() - index

Returns

The new buffer

Attributes

Remarks

Creates a new buffer whose content is a shared subsequence of this buffer's content.

The content of the new buffer will start at position index in this buffer, and will contain length elements. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position, limit, and mark values will be independent.

The new buffer's position will be zero, its capacity and its limit will be length, its mark will be undefined. The new buffer will be direct if, and only if, this buffer is direct, and it will be read-only if, and only if, this buffer is read-only.

Added in 13.

Java documentation for java.nio.Buffer.slice(int, int).

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