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 double-precision floating-point number.
Decodes 16-bit signed integer.
Decodes 32-bit signed integer.
Decodes 64-bit signed integer.
Decodes single-precision floating-point number.
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 the contents of string builder to the buffer.
Writes single element to the buffer.
Writes the sequence of elements to the buffer.
Writes the contents of string builder 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.
Writes the contents of string builder to the buffer.
public static void WriteDouble(this ref BufferWriterSlim builder, double value, bool isLittleEndian)
Encodes doubke-precision floating-point number as bytes.
Writes double-precision floating-point number to the block of memory.
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.
Encodes single-precision floating-point number as bytes.
Writes single-precision floating-point number 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.