Interface IBufferedWriter
Represents buffered writer.
Inherited Members
Namespace: DotNext.Buffers
Assembly: DotNext.IO.dll
Syntax
public interface IBufferedWriter : IBufferedChannel, IResettable, IDisposable, IBufferWriter<byte>
Properties
| Edit this page View SourceBuffer
The remaining part of the internal buffer available for write.
Declaration
Memory<byte> Buffer { get; }
Property Value
Type | Description |
---|---|
Memory<byte> |
Remarks
The size of returned buffer may be less than or equal to MaxBufferSize.
Methods
| Edit this page View SourceProduce(int)
Marks the specified number of bytes in the buffer as produced.
Declaration
void Produce(int count)
Parameters
Type | Name | Description |
---|---|---|
int | count | The number of produced bytes. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException |
|
ObjectDisposedException | The writer has been disposed. |
WriteAsync(ReadOnlyMemory<byte>, CancellationToken)
Writes the data to the underlying storage through the buffer.
Declaration
ValueTask WriteAsync(ReadOnlyMemory<byte> input, CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlyMemory<byte> | input | The input data to write. |
CancellationToken | token | The token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask | The task representing asynchronous result. |
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | The object has been disposed. |
OperationCanceledException | The operation has been canceled. |
WriteAsync(CancellationToken)
Flushes buffered data to the underlying storage.
Declaration
ValueTask WriteAsync(CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | token | The token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask | The task representing asynchronous result. |
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | The writer has been disposed. |
OperationCanceledException | The operation has been canceled. |