BufferHelpers
Represents helper methods to work with various buffer representations.
Constructs the string from the buffer.
Writes concatenated strings.
Converts two memory blocks to ReadOnlySequence<T> data type.
Writes concatenated strings.
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 half-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.
Constructs a sequence of characters from a collection of strings.
Trims the memory block to specified length if it exceeds it.
If length is less that maxLength then the original block returned.
Trims the memory block to specified length if it exceeds it.
If length is less that maxLength then the original block returned.
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 a string builder to the buffer.
public static void Write<T>(this ref SpanWriter writer, T value, ReadOnlySpan<char> format = default, IFormatProvider provider = null) where T : ISpanFormattable
Converts the value to a set of characters and writes them to the buffer.
public static int WriteAsString<T>(this ref BufferWriterSlim writer, T value, string format = null, IFormatProvider provider = null)
Writes the value as a string.
public static int WriteAsString<T>(this IBufferWriter<char> writer, T value, string format = null, IFormatProvider provider = null)
Writes the value as a string.
public static void WriteDouble(this ref BufferWriterSlim builder, double value, bool isLittleEndian)
Encodes double-precision floating-point number as bytes.
Writes double-precision floating-point number to the block of memory.
public static int WriteFormattable<T>(this ref BufferWriterSlim writer, T value, ReadOnlySpan<char> format = default, IFormatProvider provider = null) where T : ISpanFormattable
Writes the value as a sequence of characters.
public static void WriteFormattable<T>(this ref BufferWriterSlim writer, T value) where T : IBinaryFormattable<T>
Writes the value as a sequence of bytes.
public static void WriteFormattable<T>(this ref BufferWriterSlim writer, ReadOnlySpan<T> values) where T : IBinaryFormattable<T>
Writes a sequence of formattable values.
public static int WriteFormattable<T>(this IBufferWriter<char> writer, T value, ReadOnlySpan<char> format = default, IFormatProvider provider = null) where T : ISpanFormattable
Converts the value to the characters and write them to the buffer.
public static void WriteFormattable<T>(this IBufferWriter<byte> writer, T value) where T : IBinaryFormattable<T>
Writes the value as a sequence of bytes.
public static void WriteFormattable<T>(this IBufferWriter<byte> writer, ReadOnlySpan<T> values) where T : IBinaryFormattable<T>
Writes a sequence of formattable values.
Encodes half-precision floating-point number as bytes.
Writes half-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.
Writes line termination symbols to the buffer.
Writes a string to the buffer, followed by a line terminator.
Writes line termination symbols to the buffer.
Writes a string to the buffer, followed by a line terminator.
Encodes single-precision floating-point number as bytes.
Writes single-precision floating-point number to the block of memory.
public static int WriteString(this ref BufferWriterSlim writer, IFormatProvider provider, ref BufferWriterSlimInterpolatedStringHandler handler)
Writes interpolated string to the buffer.
public static int WriteString(this ref BufferWriterSlim writer, ref BufferWriterSlimInterpolatedStringHandler handler)
Writes interpolated string to the buffer.
public static int WriteString(this IBufferWriter<char> writer, IFormatProvider provider, ref BufferWriterInterpolatedStringHandler handler)
Writes interpolated string to the buffer.
public static int WriteString(this IBufferWriter<char> writer, ref BufferWriterInterpolatedStringHandler handler)
Writes interpolated string to the buffer.
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.