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 BufferMemoryInherited 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
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
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
Returns a BufferMemory object containing the specified slice of the source buffer.
Exceptions
Thrown when the starting index or length is negative.
Thrown when the sum of the starting index and length exceeds the source buffer’s length.