Class CircularDataBuffer
A DataBuffer that uses a circular buffer to manage data.
Inherited Members
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public class CircularDataBuffer : DataBuffer
Properties
Capacity
Gets the capacity of this CircularDataBuffer.
Declaration
public int Capacity { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Data
Gets the data.
Declaration
public override byte[] Data { get; }
Property Value
Type | Description |
---|---|
System.Byte[] |
Overrides
Methods
AppendDataBuffer(DataBuffer)
Appends a data buffer to the correct place in this circular data buffer.
Declaration
public void AppendDataBuffer(DataBuffer buffer)
Parameters
Type | Name | Description |
---|---|---|
DataBuffer | buffer | The buffer to write. |
BeginWrite(Int32)
Tells the CircularDataBuffer to expect more data of up to maxWriteSize. Will reshuffle data around or resize if necessary.
Declaration
public int BeginWrite(int maxWriteSize)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | maxWriteSize | The amount of bytes to make available for writing. |
Returns
Type | Description |
---|---|
System.Int32 |
Create(Int32)
Creates a new instance of the CircularDataBuffer that can hold a initial amount of data.
Declaration
public static CircularDataBuffer Create(int initialSize)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | initialSize | The initial size of the inner buffer. |
Returns
Type | Description |
---|---|
CircularDataBuffer |
Discard(Int32)
Advances the Index by amount so the space used by the data can be reused.
Declaration
public void Discard(int amount)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | amount | The amount to advance the Index by. |
EndWrite(Int32)
Tells the CircularDataBuffer how much data was actually written so that the Length can be set appropriately.
Declaration
public void EndWrite(int actuallyWrittenSize)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | actuallyWrittenSize | The amount of data actually written to the data buffer. |
Free()
Frees the internal pooled DataBuffer.
Declaration
public override DataBuffer Free()
Returns
Type | Description |
---|---|
DataBuffer |