Class BufferHelpers
Represents helper methods to work with various buffer representations.
Inherited Members
Namespace: DotNext.Buffers
Assembly: DotNext.dll
Syntax
public static class BufferHelpers
Methods
| Improve this Doc View SourceBuildString(IGrowableBuffer<Char>)
Constructs the string from the buffer.
Declaration
public static string BuildString(this IGrowableBuffer<char> writer)
Parameters
Type | Name | Description |
---|---|---|
IGrowableBuffer<Char> | writer | The buffer of characters. |
Returns
Type | Description |
---|---|
String | The string constructed from the buffer. |
BuildString(ArrayBufferWriter<Char>)
Constructs the string from the buffer.
Declaration
public static string BuildString(this ArrayBufferWriter<char> writer)
Parameters
Type | Name | Description |
---|---|---|
ArrayBufferWriter<Char> | writer | The buffer of characters. |
Returns
Type | Description |
---|---|
String | The string constructed from the buffer. |
BuildString(ReadOnlySequence<Char>)
Constructs the string from non-contiguous buffer.
Declaration
public static string BuildString(this in ReadOnlySequence<char> sequence)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlySequence<Char> | sequence | The sequence of characters. |
Returns
Type | Description |
---|---|
String | The string constucted from the characters containing in the buffer. |
Concat<T>(ReadOnlyMemory<T>, ReadOnlyMemory<T>)
Converts two memory blocks to ReadOnlySequence<T> data type.
Declaration
public static ReadOnlySequence<T> Concat<T>(this ReadOnlyMemory<T> first, ReadOnlyMemory<T> second)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlyMemory<T> | first | The first memory block. |
ReadOnlyMemory<T> | second | The second memory block. |
Returns
Type | Description |
---|---|
ReadOnlySequence<T> | The constructed ReadOnlySequence<T> instance containing memory blocks. |
Type Parameters
Name | Description |
---|---|
T | The type of elements in the memory blocks. |
ToReadOnlySequence<T>(IEnumerable<ReadOnlyMemory<T>>)
Converts the sequence of memory blocks to ReadOnlySequence<T> data type.
Declaration
public static ReadOnlySequence<T> ToReadOnlySequence<T>(this IEnumerable<ReadOnlyMemory<T>> chunks)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<ReadOnlyMemory<T>> | chunks | The sequence of memory blocks. |
Returns
Type | Description |
---|---|
ReadOnlySequence<T> | The constructed ReadOnlySequence<T> instance containing memory blocks. |
Type Parameters
Name | Description |
---|---|
T | The type of elements in the memory blocks. |
Write<T>(IBufferWriter<T>, T)
Writes single element to the buffer.
Declaration
public static void Write<T>(this IBufferWriter<T> writer, T value)
Parameters
Type | Name | Description |
---|---|---|
IBufferWriter<T> | writer | The buffer writer. |
T | value | The value to add. |
Type Parameters
Name | Description |
---|---|
T | The type of elements in the buffer. |