Skip to content

ArcBufferWriter Methods

A System.Buffers.IBufferWriter implementation implemented using pooled arrays which is specialized for creating System.Buffers.ReadOnlySequence instances.

AdvanceReader(int)

View source
public void AdvanceReader(int count)
Advances the reader by the specified number of bytes.

Parameters

countint
The number of bytes to advance the reader.

Exceptions

System.ObjectDisposedException
The writer has been disposed.

AdvanceWriter(int)

View source
public void AdvanceWriter(int count)
Advances the writer by the specified number of bytes.

Parameters

countint
The numbers of bytes to advance the writer by.

AppendPinned(ArcBuffer)

View source
public void AppendPinned(ArcBuffer input)
Appends the pages referenced by input by pinning them.

Parameters

inputArcBuffer

Exceptions

System.ObjectDisposedException
The writer has been disposed.

ConsumeSlice(int)

View source
public ArcBuffer ConsumeSlice(int count)
Consumes a slice of the provided length.

Parameters

countint
The number of bytes to consume.

Returns

A buffer representing the consumed data.

Dispose

View source
public void Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

GetMemory(int)

View source
public Memory<byte> GetMemory(int sizeHint = 0)
Returns a System.Memory to write to that is at least the requested size (specified by sizeHint).

Parameters

sizeHintint
The minimum length of the returned System.Memory. If 0, a non-empty buffer is returned.

Returns

A System.Memory of at least the size sizeHint. If sizeHint is 0, returns a non-empty buffer.

Exceptions

System.OutOfMemoryException
The requested buffer size is not available.

GetSpan(int)

View source
public Span<byte> GetSpan(int sizeHint = 0)
Returns a System.Span to write to that is at least the requested size (specified by sizeHint).

Parameters

sizeHintint
The minimum length of the returned System.Span. If 0, a non-empty buffer is returned.

Returns

A System.Span of at least the size sizeHint. If sizeHint is 0, returns a non-empty buffer.

Peek(Span<byte>)

View source
public ReadOnlySpan<byte> Peek(scoped in Span<byte> destination)
Attempts to read the provided number of bytes from the buffer.

Parameters

destinationSpan<byte>
The destination, which may be used to hold the requested data if the data needs to be copied.

Returns

A span of either zero length, if the data is unavailable, or at least the requested length if the data is available.

PeekSlice(int)

View source
public ArcBuffer PeekSlice(int count)
Returns a slice of the provided length without marking the data referred to it as consumed.

Parameters

countint
The number of bytes to consume.

Returns

A slice of unconsumed data.

Exceptions

System.ObjectDisposedException
The writer has been disposed.

ReplenishBuffers(List<ArraySegment<byte>>)

View source
public void ReplenishBuffers(List<ArraySegment<byte>> buffers)
Adds additional buffers to the destination list until the list has reached its capacity.

Parameters

buffersList<ArraySegment<byte>>
The destination to add buffers to.

Reset

View source
public void Reset()
Resets this instance, returning all memory.

Truncate(int)

View source
public void Truncate(int length)
Truncates this buffer to the specified unconsumed length.

Parameters

lengthint

WriteAt(int, ReadOnlySpan<byte>)

View source
public void WriteAt(int offset, ReadOnlySpan<byte> value)
Overwrites bytes which have already been written without changing the reader or writer positions.

Parameters

offsetint
valueReadOnlySpan<byte>