BufferHelpers
Represents helper methods to work with various buffer representations.
Constructs the string from the buffer.
Converts two memory blocks to ReadOnlySequence<T> data type.
public static void CopyTo<T>(this ref ReadOnlySequence source, Span<T> destination, out int writtenCount)
Copies the contents from the source sequence into a destination span.
Gets managed pointer to the first element in the rented memory block.
public static T Read<T>(this ref SpanReader reader) where T : ValueType modreq(System.Runtime.InteropServices.UnmanagedType)
Reads the value of blittable type from the raw bytes
represents by memory block.
Decodes 16-bit signed integer.
Decodes 32-bit signed integer.
Decodes 64-bit signed integer.
Decodes 16-bit unsigned integer.
Decodes 32-bit unsigned integer.
Decodes 64-bit unsigned integer.
Releases all resources encapsulated by the container.
public static void Resize<T>(this ref MemoryOwner owner, int newLength, bool exactSize = true, MemoryAllocator<T> allocator = null)
Resizes the buffer.
Converts the sequence of memory blocks to ReadOnlySequence<T> data type.
public static bool TryRead<T>(this ref SpanReader reader, out T result) where T : ValueType modreq(System.Runtime.InteropServices.UnmanagedType)
Reads the value of blittable type from the raw bytes
represents by memory block.
public static bool TryWrite<T>(this ref SpanWriter writer, ref T value) where T : ValueType modreq(System.Runtime.InteropServices.UnmanagedType)
Writes value of blittable type as bytes to the underlying memory block.
Writes single element to the buffer.
Writes the sequence of elements to the buffer.
public static void Write<T>(this ref SpanWriter writer, ref T value) where T : ValueType modreq(System.Runtime.InteropServices.UnmanagedType)
Writes value of blittable type as bytes to the underlying memory block.
Encodes 16-bit signed integer as bytes.
Writes 16-bit signed integer to the block of memory.
Encodes 32-bit signed integer as bytes.
Writes 32-bit signed integer to the block of memory.
Encodes 64-bit signed integer as bytes.
Writes 64-bit signed integer to the block of memory.
public static void WriteUInt16(this ref BufferWriterSlim builder, ushort value, bool isLittleEndian)
Encodes 16-bit unsigned integer as bytes.
Writes 16-bit unsigned integer to the block of memory.
Encodes 32-bit unsigned integer as bytes.
Writes 32-bit unsigned integer to the block of memory.
Encodes 64-bit unsigned integer as bytes.
Writes 64-bit unsigned integer to the block of memory.