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

CustomDataHandlingAdapterTRequestFilterTByteBlock 方法

筛选解析数据。实例化的TRequest会一直保存,直至解析成功,或手动清除。

当不满足解析条件时,请返回Cache,此时会保存CanReadLength的数据

当数据部分异常时,请移动Position到指定位置,然后返回GoOn

当完全满足解析条件时,请返回Success最后将Position移至指定位置。

Definition

命名空间: TouchSocket.Core
程序集: TouchSocket.Core (在 TouchSocket.Core.dll 中) 版本:3.0.0+ccaf96084d09f972257496d1dd63b8ba3c1e44f0
C#
protected abstract FilterResult Filter<TByteBlock>(
	ref TByteBlock byteBlock,
	bool beCached,
	ref TRequest request,
	ref int tempCapacity
)
where TByteBlock : IByteBlock

参数

byteBlock  TByteBlock
字节块
beCached  Boolean
是否为上次遗留对象,当该参数为True时,request也将是上次实例化的对象。
request  TRequest
对象。
tempCapacity  Int32
缓存容量。当需要首次缓存时,指示申请的ByteBlock的容量。合理的值可避免ByteBlock扩容带来的性能消耗。

类型参数

TByteBlock

[缺少 "M:TouchSocket.Core.CustomDataHandlingAdapter`1.Filter``1(``0@,System.Boolean,`0@,System.Int32@)" 的 <typeparam name="TByteBlock"/> 文档]

返回值

FilterResult

[缺少 "M:TouchSocket.Core.CustomDataHandlingAdapter`1.Filter``1(``0@,System.Boolean,`0@,System.Int32@)" 的 <returns> 文档]

参见