Show / Hide Table of Contents

Interface IBufferedReader

Represents buffered reader.

Inherited Members
IBufferedChannel.Allocator
IBufferedChannel.MaxBufferSize
IResettable.Reset()
IDisposable.Dispose()
Namespace: DotNext.Buffers
Assembly: DotNext.IO.dll
Syntax
public interface IBufferedReader : IBufferedChannel, IResettable, IDisposable

Properties

| Edit this page View Source

Buffer

Gets unconsumed part of the buffer.

Declaration
ReadOnlyMemory<byte> Buffer { get; }
Property Value
Type Description
ReadOnlyMemory<byte>

Methods

| Edit this page View Source

Consume(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

count is larger than the length of Buffer.

| Edit this page View Source

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 destination.

Exceptions
Type Condition
ObjectDisposedException

The reader has been disposed.

OperationCanceledException

The operation has been canceled.

| Edit this page View Source

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.

Extension Methods

BasicExtensions.As<T>(T)
BasicExtensions.GetUserData<T>(T)
BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, ReadOnlySpan<T>)
ExpressionBuilder.Const<T>(T)
AsyncLockAcquisition.AcquireLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, TimeSpan, CancellationToken)
LockAcquisition.AcquireReadLock<T>(T)
LockAcquisition.AcquireReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireUpgradeableReadLock<T>(T)
LockAcquisition.AcquireUpgradeableReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireWriteLock<T>(T)
LockAcquisition.AcquireWriteLock<T>(T, TimeSpan)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾