Show / Hide Table of Contents

Class PooledBufferWriter<T>

Represents memory writer that uses pooled memory.

Inheritance
Object
Disposable
MemoryWriter<T>
PooledBufferWriter<T>
Implements
IBufferWriter<T>
IConvertible<ReadOnlyMemory<T>>
IReadOnlyList<T>
IReadOnlyCollection<T>
IEnumerable<T>
IEnumerable
IGrowableBuffer<T>
IDisposable
Inherited Members
MemoryWriter<T>.AllocationCounter
MemoryWriter<T>.BufferSizeCallback
MemoryWriter<T>.IConvertible<ReadOnlyMemory<T>>.Convert()
MemoryWriter<T>.WrittenCount
MemoryWriter<T>.IGrowableBuffer<T>.WrittenCount
MemoryWriter<T>.IGrowableBuffer<T>.Write(ReadOnlySpan<T>)
MemoryWriter<T>.IGrowableBuffer<T>.CopyTo<TArg>(ReadOnlySpanAction<T, TState>, TState)
MemoryWriter<T>.IGrowableBuffer<T>.CopyTo(Span<T>)
MemoryWriter<T>.Add(T)
MemoryWriter<T>.AddAll(ICollection<T>)
MemoryWriter<T>.IReadOnlyCollection<T>.Count
MemoryWriter<T>.Item[Int32]
MemoryWriter<T>.IReadOnlyList<T>.Item[Int32]
MemoryWriter<T>.FreeCapacity
MemoryWriter<T>.Advance(Int32)
MemoryWriter<T>.GetSpan(Int32)
MemoryWriter<T>.GetEnumerator()
MemoryWriter<T>.IEnumerable.GetEnumerator()
Disposable.IsDisposed
Disposable.ThrowIfDisposed()
Disposable.DisposedTask
Disposable.GetDisposedTask<T>()
Disposable.TrySetDisposedException<T>(TaskCompletionSource<T>)
Disposable.Dispose()
Disposable.QueueDispose(IDisposable)
Disposable.Dispose(IEnumerable<IDisposable>)
Disposable.DisposeAsync(IEnumerable<IAsyncDisposable>)
Disposable.Dispose(IDisposable[])
Disposable.DisposeAsync(IAsyncDisposable[])
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: DotNext.Buffers
Assembly: DotNext.dll
Syntax
public sealed class PooledBufferWriter<T> : MemoryWriter<T>, IBufferWriter<T>, IConvertible<ReadOnlyMemory<T>>, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable, IGrowableBuffer<T>, IDisposable
Type Parameters
Name Description
T

The data type that can be written.

Constructors

| Improve this Doc View Source

PooledBufferWriter(MemoryAllocator<T>)

Initializes a new writer with the default initial capacity.

Declaration
public PooledBufferWriter(MemoryAllocator<T> allocator = null)
Parameters
Type Name Description
MemoryAllocator<T> allocator

The allocator of internal buffer.

| Improve this Doc View Source

PooledBufferWriter(MemoryAllocator<T>, Int32)

Initializes a new writer with the specified initial capacity.

Declaration
public PooledBufferWriter(MemoryAllocator<T> allocator, int initialCapacity)
Parameters
Type Name Description
MemoryAllocator<T> allocator

The allocator of internal buffer.

Int32 initialCapacity

The initial capacity of the writer.

Exceptions
Type Condition
ArgumentOutOfRangeException

initialCapacity is less than or equal to zero.

Properties

| Improve this Doc View Source

Capacity

Gets the total amount of space within the underlying memory.

Declaration
public override int Capacity { get; }
Property Value
Type Description
Int32
Overrides
DotNext.Buffers.MemoryWriter<T>.Capacity
Exceptions
Type Condition
ObjectDisposedException

This writer has been disposed.

| Improve this Doc View Source

WrittenMemory

Gets the data written to the underlying buffer so far.

Declaration
public override ReadOnlyMemory<T> WrittenMemory { get; }
Property Value
Type Description
ReadOnlyMemory<T>
Overrides
DotNext.Buffers.MemoryWriter<T>.WrittenMemory
Exceptions
Type Condition
ObjectDisposedException

This writer has been disposed.

Methods

| Improve this Doc View Source

Clear()

Clears the data written to the underlying buffer.

Declaration
public override void Clear()
Overrides
DotNext.Buffers.MemoryWriter<T>.Clear()
Exceptions
Type Condition
ObjectDisposedException

This writer has been disposed.

| Improve this Doc View Source

Clear(Boolean)

Clears the data written to the underlying memory.

Declaration
public override void Clear(bool reuseBuffer)
Parameters
Type Name Description
Boolean reuseBuffer

true to reuse the internal buffer; false to destroy the internal buffer.

Overrides
DotNext.Buffers.MemoryWriter<T>.Clear(System.Boolean)
Exceptions
Type Condition
ObjectDisposedException

This writer has been disposed.

| Improve this Doc View Source

Dispose(Boolean)

Declaration
protected override void Dispose(bool disposing)
Parameters
Type Name Description
Boolean disposing
Overrides
DotNext.Buffers.MemoryWriter<T>.Dispose(System.Boolean)
| Improve this Doc View Source

GetMemory(Int32)

Returns the memory to write to that is at least the requested size.

Declaration
public override Memory<T> GetMemory(int sizeHint = 0)
Parameters
Type Name Description
Int32 sizeHint

The minimum length of the returned memory.

Returns
Type Description
Memory<T>

The memory block of at least the size sizeHint.

Overrides
DotNext.Buffers.MemoryWriter<T>.GetMemory(System.Int32)
Exceptions
Type Condition
OutOfMemoryException

The requested buffer size is not available.

ObjectDisposedException

This writer has been disposed.

Implements

System.Buffers.IBufferWriter<T>
IConvertible<T>
System.Collections.Generic.IReadOnlyList<T>
System.Collections.Generic.IReadOnlyCollection<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable
IGrowableBuffer<T>
System.IDisposable

Extension Methods

AsyncLockAcquisition.AcquireLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireUpgradeableReadLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireUpgradeableReadLockAsync<T>(T, CancellationToken)
ObjectExtensions.GetUserData<T>(T)
ObjectExtensions.IsOneOf<T>(T, IEnumerable<T>)
ObjectExtensions.IsOneOf<T>(T, T[])
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, Func<T, TResult1>, Func<T, TResult2>, out TResult1, out TResult2)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, ValueFunc<T, TResult1>, ValueFunc<T, TResult2>, out TResult1, out TResult2)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, Func<T, TResult1>, Func<T, TResult2>)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, ValueFunc<T, TResult1>, ValueFunc<T, TResult2>)
ObjectExtensions.As<T>(T)
BufferHelpers.Write<T>(IBufferWriter<T>, T)
LockAcquisition.AcquireReadLock<T>(T)
LockAcquisition.AcquireReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireWriteLock<T>(T)
LockAcquisition.AcquireWriteLock<T>(T, TimeSpan)
LockAcquisition.AcquireUpgradeableReadLock<T>(T)
LockAcquisition.AcquireUpgradeableReadLock<T>(T, TimeSpan)
Collection.Convert<TInput, TOutput>(IReadOnlyCollection<TInput>, ValueFunc<TInput, TOutput>)
Collection.Convert<TInput, TOutput>(IReadOnlyCollection<TInput>, Converter<TInput, TOutput>)
List.IndexerGetter<T>(IReadOnlyList<T>)
List.Convert<TInput, TOutput>(IReadOnlyList<TInput>, ValueFunc<TInput, TOutput>)
List.Convert<TInput, TOutput>(IReadOnlyList<TInput>, Converter<TInput, TOutput>)
Sequence.ToAsyncEnumerable<T>(IEnumerable<T>)
Sequence.GetAsyncEnumerator<T>(IEnumerable<T>, CancellationToken)
Sequence.ForEach<T>(IEnumerable<T>, Action<T>)
Sequence.ForEach<T>(IEnumerable<T>, ValueAction<T>)
Sequence.ForEachAsync<T>(IEnumerable<T>, Func<T, CancellationToken, ValueTask>, CancellationToken)
Sequence.ForEachAsync<T>(IEnumerable<T>, ValueFunc<T, CancellationToken, ValueTask>, CancellationToken)
Sequence.FirstOrEmpty<T>(IEnumerable<T>)
Sequence.FirstOrEmpty<T>(IEnumerable<T>, ValueFunc<T, Boolean>)
Sequence.FirstOrEmpty<T>(IEnumerable<T>, Predicate<T>)
Sequence.ElementAt<T>(IEnumerable<T>, Int32, out T)
Sequence.ToString<T>(IEnumerable<T>, String, String)
Sequence.Prepend<T>(IEnumerable<T>, T[])
Sequence.Append<T>(IEnumerable<T>, T[])
BufferWriter.Write<T>(IBufferWriter<T>, ReadOnlySequence<T>, CancellationToken)
BufferWriter.Write<T>(IBufferWriter<T>, T[], Int32, Int32)
ExpressionBuilder.Const<T>(T)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX