Interface IBufferedReader
Represents buffered reader.
Inherited Members
Namespace: DotNext.Buffers
Assembly: DotNext.IO.dll
Syntax
public interface IBufferedReader : IBufferedChannel, IResettable, IDisposable
Properties
| Edit this page View SourceBuffer
Gets unconsumed part of the buffer.
Declaration
ReadOnlyMemory<byte> Buffer { get; }
Property Value
Type | Description |
---|---|
ReadOnlyMemory<byte> |
Methods
| Edit this page View SourceConsume(int)
Advances read position.
Declaration
void Consume(int count)
Parameters
Type | Name | Description |
---|---|---|
int | count | The number of consumed bytes. |
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | The reader has been disposed. |
ArgumentOutOfRangeException |
|
ReadAsync(Memory<byte>, CancellationToken)
Reads the block of the memory.
Declaration
ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
Memory<byte> | destination | The output buffer. |
CancellationToken | token | The token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask<int> | The number of bytes copied to |
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | The reader has been disposed. |
OperationCanceledException | The operation has been canceled. |
ReadAsync(CancellationToken)
Fetches the data from the underlying storage to the internal buffer.
Declaration
ValueTask<bool> ReadAsync(CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | token | The token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask<bool> | true if the data has been copied from the underlying storage to the internal buffer; false if no more data to read. |
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | The reader has been disposed. |
InternalBufferOverflowException | Internal buffer has no free space. |
OperationCanceledException | The operation has been canceled. |