Class NatsBufferWriter<T>
Represents a heap-based, array-backed output sink into which T
data can be written.
public sealed class NatsBufferWriter<T> : IBufferWriter<T>, IMemoryOwner<T>, IDisposable
Type Parameters
T
The type of items to write to the current instance.
- Inheritance
-
NatsBufferWriter<T>
- Implements
-
IMemoryOwner<T>
- Inherited Members
Constructors
- NatsBufferWriter()
Initializes a new instance of the NatsBufferWriter<T> class.
- NatsBufferWriter(ArrayPool<T>)
Initializes a new instance of the NatsBufferWriter<T> class.
- NatsBufferWriter(ArrayPool<T>, int)
Initializes a new instance of the NatsBufferWriter<T> class.
- NatsBufferWriter(int)
Initializes a new instance of the NatsBufferWriter<T> class.
Properties
- Capacity
Gets the total amount of space within the underlying buffer.
- FreeCapacity
Gets the amount of space available that can still be written into without forcing the underlying buffer to grow.
- WrittenCount
Gets the amount of data written to the underlying buffer so far.
- WrittenMemory
Gets the data written to the underlying buffer so far, as a ReadOnlyMemory<T>.
- WrittenSpan
Gets the data written to the underlying buffer so far, as a ReadOnlySpan<T>.
Methods
- Advance(int)
Notifies the IBufferWriter<T> that
count
data items were written to the output Span<T> or Memory<T>.
- Clear()
Clears the data written to the underlying buffer.
- DangerousGetArray()
Gets an ArraySegment<T> instance wrapping the underlying
T
array in use.
- Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- GetMemory(int)
Returns a Memory<T> to write to that is at least the requested size (specified by
sizeHint
).
- GetSpan(int)
Returns a Span<T> to write to that is at least the requested size (specified by
sizeHint
).
- ToString()
Returns a string that represents the current object.