Interface IGrowableBuffer<T>
Represents common interface for growable buffer writers.
Inherited Members
Namespace: DotNext.Buffers
Assembly: DotNext.dll
Syntax
public interface IGrowableBuffer<T> : IDisposable
Type Parameters
Name | Description |
---|---|
T | The type of the elements in the buffer. |
Remarks
This interface is intended to describe the shape of all buffer writer types in .NEXT family of libraries. It is not recommended to have custom implementation of this interface in your code.
Properties
| Improve this Doc View SourceCapacity
Gets the maximum number of elements that can hold this buffer.
Declaration
virtual long? Capacity { get; }
Property Value
Type | Description |
---|---|
Nullable<Int64> | The maximum number of elements; or null if this buffer has no limits. |
WrittenCount
Gets the number of written elements.
Declaration
long WrittenCount { get; }
Property Value
Type | Description |
---|---|
Int64 |
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | The writer has been disposed. |
Methods
| Improve this Doc View SourceClear()
Clears the contents of the writer.
Declaration
void Clear()
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | The writer has been disposed. |
CopyTo(Span<T>)
Copies the contents of this writer to the specified memory block.
Declaration
int CopyTo(Span<T> output)
Parameters
Type | Name | Description |
---|---|---|
Span<T> | output | The memory block to be modified. |
Returns
Type | Description |
---|---|
Int32 | The actual number of copied elements. |
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | The builder has been disposed. |
CopyTo<TArg>(ReadOnlySpanAction<T, TArg>, TArg)
Passes the contents of this writer to the callback.
Declaration
void CopyTo<TArg>(ReadOnlySpanAction<T, TArg> callback, TArg arg)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlySpanAction<T, TArg> | callback | The callback used to accept the memory representing the contents of this builder. |
TArg | arg | The argument to be passed to the callback. |
Type Parameters
Name | Description |
---|---|
TArg | The type of the object that represents the state. |
Remarks
The callback may be called multiple times.
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | The writer has been disposed. |
Write(T)
Writes single element to this buffer.
Declaration
virtual void Write(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value | The value to be written. |
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | The writer has been disposed. |
Write(ReadOnlySpan<T>)
Writes the memory block.
Declaration
void Write(ReadOnlySpan<T> input)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlySpan<T> | input | The memory block to be written. |
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | The writer has been disposed. |