Skip to content

BufferSegment

Represents a segment (a continuous section) of a byte array, providing functionalities to work with a portion of the data without copying.

Fields:

BufferSegment BufferSegment.Empty

Represents an empty buffer segment.

Byte[] Data

The underlying data of the buffer segment.

Int32 Offset

The starting offset of the segment within the data.

Int32 Count

The number of bytes in the segment that contain valid data.

Methods:

AutoReleaseBuffer AsAutoRelease()

Converts the buffer segment to an AutoReleaseBuffer to use it in a local using statement.

BufferSegment Slice(Int32)

Creates a new segment starting from the specified offset.
The new segment will reference the same underlying byte[] as the original, without creating a copy of the data.

BufferSegment Slice(Int32, Int32)

Creates a new segment with the specified offset and count.
The new segment will reference the same underlying byte[] as the original, without creating a copy of the data.

CopyTo(Byte[])

Copyies the buffer's content to the received array.

Comments