Show / Hide Table of Contents

Interface IBufferedWriter

Represents buffered writer.

Inherited Members
IBufferedChannel.Allocator
IBufferedChannel.MaxBufferSize
IResettable.Reset()
IDisposable.Dispose()
IBufferWriter<byte>.Advance(int)
IBufferWriter<byte>.GetMemory(int)
IBufferWriter<byte>.GetSpan(int)
Namespace: DotNext.Buffers
Assembly: DotNext.IO.dll
Syntax
public interface IBufferedWriter : IBufferedChannel, IResettable, IDisposable, IBufferWriter<byte>

Properties

| Edit this page View Source

Buffer

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 Source

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

count is larger than the length of Buffer.

ObjectDisposedException

The writer has been disposed.

| Edit this page View Source

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.

| Edit this page View Source

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.

Extension Methods

BasicExtensions.As<T>(T)
BasicExtensions.GetUserData<T>(T)
BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, ReadOnlySpan<T>)
StreamSource.AsStream<TWriter>(TWriter, Action<TWriter>?, Func<TWriter, CancellationToken, Task>?)
TextStreamExtensions.AsTextWriter<TWriter>(TWriter, Encoding, IFormatProvider?, Action<TWriter>?, Func<TWriter, CancellationToken, Task>?)
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)
BufferWriter.Encode(IBufferWriter<byte>, ReadOnlySpan<char>, in EncodingContext, LengthFormat?)
BufferWriter.Format<T>(IBufferWriter<byte>, T, in EncodingContext, LengthFormat?, ReadOnlySpan<char>, IFormatProvider?, MemoryAllocator<char>?)
BufferWriter.Format<T>(IBufferWriter<byte>, T, LengthFormat?, ReadOnlySpan<char>, IFormatProvider?)
BufferWriter.Interpolate(IBufferWriter<byte>, in EncodingContext, Span<char>, in EncodingInterpolatedStringHandler)
BufferWriter.Interpolate(IBufferWriter<byte>, in EncodingContext, Span<char>, IFormatProvider?, in EncodingInterpolatedStringHandler)
BufferWriter.Write<T>(IBufferWriter<T>, in ReadOnlySequence<T>)
ByteBuffer.Format<T>(IBufferWriter<byte>, T, ReadOnlySpan<char>, IFormatProvider?)
ByteBuffer.Write(IBufferWriter<byte>, in BigInteger, bool, bool)
ByteBuffer.WriteBigEndian<T>(IBufferWriter<byte>, T)
ByteBuffer.WriteLittleEndian<T>(IBufferWriter<byte>, T)
ByteBuffer.Write<T>(IBufferWriter<byte>, T)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾