Skip to content

Struct BufferMemory

Namespace: Void.Minecraft.Buffers
Assembly: Void.Minecraft.dll

Represents a memory buffer that can be sliced into smaller segments. Provides a way to access a specific range of bytes within the buffer.

public readonly struct BufferMemory

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Extension Methods

StructExtensions.IsDefault<BufferMemory>(BufferMemory)

Constructors

BufferMemory(Memory<byte>)

Represents a memory buffer that can be sliced into smaller segments. Provides a way to access a specific range of bytes within the buffer.

public BufferMemory(Memory<byte> source)

Parameters

source Memory<byte>

The input memory provides the raw byte data to be manipulated and accessed.

Properties

Span

Returns a new BufferSpan instance based on the source’s Span. It provides a read-only view of the underlying buffer.

public BufferSpan Span { get; }

Property Value

BufferSpan

Methods

Slice(int, int)

Creates a new BufferMemory instance that represents a portion of the source buffer.

public BufferMemory Slice(int position, int length)

Parameters

position int

Specifies the starting index of the slice within the source buffer.

length int

Indicates the number of elements to include in the slice from the starting index.

Returns

BufferMemory

Returns a BufferMemory object containing the specified slice of the source buffer.

Exceptions

ArgumentOutOfRangeException

Thrown when the starting index or length is negative.

EndOfBufferException

Thrown when the sum of the starting index and length exceeds the source buffer’s length.