Class CircularBuffer
A very basic circular buffer implementation
public class CircularBuffer
- Inheritance
-
CircularBuffer
- Inherited Members
Constructors
CircularBuffer(int)
Create a new circular buffer
public CircularBuffer(int size)
Parameters
sizeintMax buffer size in bytes
Properties
Count
Number of bytes currently stored in the circular buffer
public int Count { get; }
Property Value
MaxLength
Maximum length of this circular buffer
public int MaxLength { get; }
Property Value
Methods
Advance(int)
Advances the buffer, discarding bytes
public void Advance(int count)
Parameters
countintBytes to advance
Read(Span<byte>)
Read from the buffer
public int Read(Span<byte> data)
Parameters
Returns
- int
Number of bytes actually read
Reset()
Resets the buffer
public void Reset()
Write(ReadOnlySpan<byte>)
Write data to the buffer
public int Write(ReadOnlySpan<byte> data)
Parameters
dataReadOnlySpan<byte>Data to write
Returns
- int
number of bytes written