一款简单易用的基础网络通讯组件库。

CircularBufferT

环形缓冲区,固定容量的读写操作。

Definition

命名空间: TouchSocket.Core
程序集: TouchSocket.Core (在 TouchSocket.Core.dll 中) 版本:4.0.0-beta.143+5fcca7a4e70968794985dc3793adc50531308be6
C#
public sealed class CircularBuffer<T>
Inheritance
Object    CircularBufferT

类型参数

T
存储的元素类型

构造函数

CircularBufferT 创建指定容量的环形缓冲区。

属性

Capacity 缓冲区总容量(最大可存放的元素数量)。
DataCount 当前缓冲区中可读取的数据数量。
IsEmpty 是否为空(无可读数据)。
IsFull 是否已满(无法再写入数据)。
Item 按相对于当前读位置的偏移获取元素(不移动读指针)。
SpaceFree 可用的剩余空间(可写入的元素数量)。

方法

AdvanceWrite 
Clear 清空缓冲区,重置读写指针和数据计数。
EqualsDetermines whether the specified object is equal to the current object.
(继承自 Object。)
GetHashCodeServes as the default hash function.
(继承自 Object。)
GetTypeGets the Type of the current instance.
(继承自 Object。)
GetWriteMemory 
Peek 将缓冲区中的数据复制到目标 SpanT 中,但不移动读指针。
Read 从缓冲区读取数据到目标 SpanT 并移动读指针。
ToStringReturns a string that represents the current object.
(继承自 Object。)
Write 将数据从源 ReadOnlySpanT 写入缓冲区。

扩展方法

Map 将源对象的属性映射到目标对象的属性中。
(由 Mapper 定义。)
Map 将源对象映射到目标类型的实例。
(由 Mapper 定义。)
MapTTarget 将源对象映射到指定目标类型的新实例。
(由 Mapper 定义。)
ToJsonString 转换为Json
(由 SerializeConvert 定义。)

参见