Interface IMemoryBuffer<T>
- Namespace
- DisCatSharp.Common.Types
- Assembly
- DisCatSharp.Common.dll
An interface describing the API of resizable memory buffers, such as MemoryBuffer<T> and ContinuousMemoryBuffer<T>.
public interface IMemoryBuffer<T> : IDisposable where T : unmanaged
Type Parameters
TType of item to hold in the buffer.
- Inherited Members
- Extension Methods
Properties
- Capacity
Gets the total capacity of this buffer. The capacity is the number of segments allocated, multiplied by size of individual segment.
- Count
Gets the number of items currently written to the buffer. This number is equal to Count divided by size of
T.
- Length
Gets the amount of bytes currently written to the buffer. This number is never greater than Capacity .
Methods
- Clear()
Resets the buffer's pointer to the beginning, allowing for reuse.
- CopyTo(Stream)
Copies all the data from this buffer to a stream.
- Read(ArraySegment<T>, ulong, out int)
Reads data from this buffer to specified destination array slice. This method will write either as many bytes as specified in the target slice, or however many bytes are available in this buffer, whichever is less.
- Read(Span<T>, ulong, out int)
Reads data from this buffer to the specified destination buffer. This method will write either as many bytes as there are in the destination buffer, or however many bytes are available in this buffer, whichever is less.
- Read(T[], int, int, ulong, out int)
Reads data from this buffer to specified destination array. This method will write either as many bytes as specified for the destination array, or however many bytes are available in this buffer, whichever is less.
- ToArray()
Converts this buffer into a single continuous byte array.
- Write(ArraySegment<T>)
Appends data from a supplied array slice to this buffer, growing it if necessary.
- Write(Stream)
Appends data from a supplied stream to this buffer, growing it if necessary.
- Write(ReadOnlySpan<T>)
Appends data from a supplied buffer to this buffer, growing it if necessary.
- Write(T[], int, int)
Appends data from a supplied array to this buffer, growing it if necessary.