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

SegmentedBytesWriter 类

表示一个分段字节写入器,提供高效的多段缓冲区写入功能。

Definition

命名空间: TouchSocket.Core
程序集: TouchSocket.Core (在 TouchSocket.Core.dll 中) 版本:4.0.0-beta.143+5fcca7a4e70968794985dc3793adc50531308be6
C#
public sealed class SegmentedBytesWriter : DisposableObject, 
	IBytesWriter, IBufferWriter<byte>
Inheritance
Object    DisposableObject    SegmentedBytesWriter
Implements
IBufferWriterByte, IBytesWriter

备注

SegmentedBytesWriter使用列表结构的缓冲段来管理内存,当单个段不足时会自动创建新段。 每个段的最小大小为4096字节,支持动态扩展。所有缓冲区都使用Shared进行内存池管理。

构造函数

SegmentedBytesWriter 初始化 SegmentedBytesWriter 类的新实例,使用默认的最小缓冲区大小(4096字节)。
SegmentedBytesWriter(Int32) 使用指定的初始容量初始化SegmentedBytesWriter的新实例。
SegmentedBytesWriter(Int32, ArrayPoolByte) 使用指定的初始容量和数组池初始化SegmentedBytesWriter的新实例。

属性

DisposedValue 标识该对象是否已被释放
(继承自 DisposableObject。)
Sequence 获取当前写入器的字节序列。
SupportsRewind 获取一个值,该值指示写入器是否支持回退操作。
Version 获取写入器的版本号。
WrittenCount 获取已写入的字节数。

方法

AdvanceNotifies the IBufferWriterT that count data items were written to the output SpanT or MemoryT.
Clear 清空所有段的数据,重置写入器到初始状态。
Dispose 释放资源。内部已经处理了SuppressFinalize(Object)
(继承自 DisposableObject。)
EqualsDetermines whether the specified object is equal to the current object.
(继承自 Object。)
GetHashCodeServes as the default hash function.
(继承自 Object。)
GetMemoryReturns a MemoryT to write to that is at least the requested size (specified by sizeHint).
GetSpanReturns a SpanT to write to that is at least the requested size (specified by sizeHint).
GetTypeGets the Type of the current instance.
(继承自 Object。)
ToStringReturns a string that represents the current object.
(继承自 Object。)
Write 将指定的字节范围写入到缓冲区中。

扩展方法

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

参见