Skip to content

Struct MemoryWriteHeap

Namespace: Tool.Sockets.Kernels
Assembly: Tool.Net.dll

用于处理超过缓冲区大小的包体

csharp
public struct MemoryWriteHeap : IBytesCore, IDisposable, IAsyncDisposable

Implements

IBytesCore, IDisposable, IAsyncDisposable

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Extension Methods

ObjectExtension.Add<T>(object, object, object), ObjectExtension.CopyEntity(object, object, params string[]), ObjectExtension.EntityToJson(object), ObjectExtension.EntityToJson(object, bool), ObjectExtension.EntityToJson(object, bool, string), DictionaryExtension.GetDictionary(object), TypeExtension.GetFieldKey(object, string, out bool), TypeExtension.GetFieldKey<T>(object, string, out bool), TypeExtension.GetFieldKey(object, Type, string, out bool), ObjectExtension.GetIntPtr(object), ObjectExtension.GetIntPtrInt(object), TypeExtension.GetPropertieFind(object, string, bool), TypeExtension.GetProperties(object), TypeExtension.GetPropertyKey(object, string, out bool), TypeExtension.GetPropertyKey<T>(object, string, out bool), TypeExtension.GetPropertyKey(object, Type, string, out bool), TypeExtension.GetValue(object, PropertyDescriptor), TypeExtension.GetValue(object, string, bool), TypeExtension.GetValue(object, string), ObjectExtension.Read<T>(object, object, int, int), ObjectExtension.Read<T>(object, int, object, int, int), DictionaryExtension.SetDictionary(object, IDictionary<string, object>), TypeExtension.SetFieldKey(object, string, object), TypeExtension.SetFieldKey<T>(object, string, object), TypeExtension.SetFieldKey(object, Type, string, object), TypeExtension.SetPropertyKey(object, string, object), TypeExtension.SetPropertyKey<T>(object, string, object), TypeExtension.SetPropertyKey(object, Type, string, object), TypeExtension.SetValue(object, PropertyDescriptor, object), TypeExtension.SetValue(object, string, object, bool), TypeExtension.SetValue(object, string, object), ObjectExtension.ToBase64String(object), ObjectExtension.ToBytes(object), ObjectExtension.ToBytes(object, out Type), DictionaryExtension.ToDictionary(object), DictionaryExtension.ToDictionary<T>(object), DictionaryExtension.ToIDictionary(object), DictionaryExtension.ToIDictionary<T>(object), ObjectExtension.ToJson(object), ObjectExtension.ToJson(object, JsonSerializerOptions), ObjectExtension.ToJsonWeb(object), ObjectExtension.ToJsonWeb(object, Action<JsonSerializerOptions>), ObjectExtension.ToTryVar<T>(object, T), ObjectExtension.ToVar<T>(object), ObjectExtension.ToVar(object, Type, bool), ObjectExtension.ToVar(object, string), ObjectExtension.ToXml(object)

Constructors

MemoryWriteHeap(int, Memory<byte>)

创建一个内存资源对象

csharp
public MemoryWriteHeap(int length, Memory<byte> memory)

Parameters

length int

内存大小

memory Memory<byte>

缓冲内存移动

Properties

Array

返回数据

csharp
public readonly ArraySegment<byte> Array { get; }

Property Value

ArraySegment<byte>

EmptyData

一个连续的空内存

csharp
public readonly Memory<byte> EmptyData { get; }

Property Value

Memory<byte>

IsDispose

获取是否被回收

csharp
public readonly bool IsDispose { get; }

Property Value

bool

IsEmpty

获取是否被清空

csharp
public readonly bool IsEmpty { get; }

Property Value

bool

IsSuccess

表示是否完全读取完成

csharp
public readonly bool IsSuccess { get; }

Property Value

bool

Length

流长度

csharp
public readonly int Length { get; }

Property Value

int

Memory

返回数据

csharp
public readonly Memory<byte> Memory { get; }

Property Value

Memory<byte>

Span

返回数据

csharp
public readonly Span<byte> Span { get; }

Property Value

Span<byte>

SpareSize

剩余大小

csharp
public readonly int SpareSize { get; }

Property Value

int

WriteIndex

写入索引

csharp
public readonly int WriteIndex { get; }

Property Value

int

Methods

Dispose()

使用完后及时回收

csharp
public void Dispose()

Empty()

清空标记

csharp
public void Empty()

GetIMemoryOwner()

获取内存器核心

csharp
public readonly IMemoryOwner<byte> GetIMemoryOwner()

Returns

IMemoryOwner<byte>

GetReceiveBytes<T>(in UserKey, T)

获取完整包返回

csharp
public ReceiveBytes<T> GetReceiveBytes<T>(in UserKey IpPort, T Client)

Parameters

IpPort UserKey

Key

Client T

连接对象

Returns

ReceiveBytes<T>

Type Parameters

T

连接对象

SetCount(int)

写入有效的接收数据包长度

csharp
public void SetCount(int count)

Parameters

count int

TransferByte()

移交内存器

csharp
public readonly BytesCore TransferByte()

Returns

BytesCore

基于Apache-2.0协议开源