Partager via


ByteBuffer.Slice Method

Definition

Overloads

Slice()

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

Slice(Int32, Int32)

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

Slice()

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

[Android.Runtime.Register("slice", "()Ljava/nio/ByteBuffer;", "GetSliceHandler")]
public abstract Java.Nio.ByteBuffer Slice ();
[<Android.Runtime.Register("slice", "()Ljava/nio/ByteBuffer;", "GetSliceHandler")>]
override this.Slice : unit -> Java.Nio.ByteBuffer

Returns

The new byte buffer

Attributes

Remarks

Creates a new byte 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 bytes remaining in this buffer, and 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.

Java documentation for java.nio.ByteBuffer.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 byte buffer whose content is a shared subsequence of this buffer's content.

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

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 byte 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, and its byte order will be ByteOrder#BIG_ENDIAN BIG_ENDIAN.

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.ByteBuffer.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