MemoryStreamBuffer 类
继承成员
命名空间: Fantasy.Serialize
程序集: Fantasy.Net.dll
语法
public sealed class MemoryStreamBuffer : MemoryStream, IAsyncDisposable, IDisposable, IBufferWriter<byte>
构造函数
| 编辑本文 查看源代码MemoryStreamBuffer()
声明
public MemoryStreamBuffer()
MemoryStreamBuffer(byte[])
声明
public MemoryStreamBuffer(byte[] buffer)
参数
类型 | 名称 | 描述 |
---|---|---|
byte[] | buffer |
MemoryStreamBuffer(int)
声明
public MemoryStreamBuffer(int capacity)
参数
类型 | 名称 | 描述 |
---|---|---|
int | capacity |
方法
| 编辑本文 查看源代码Advance(int)
Notifies the IBufferWriter<T> that count
data items were written to the output Span<T> or Memory<T>.
声明
public void Advance(int count)
参数
类型 | 名称 | 描述 |
---|---|---|
int | count | The number of data items written to the Span<T> or Memory<T>. |
GetMemory(int)
Returns a Memory<T> to write to that is at least the requested size (specified by sizeHint
).
声明
public Memory<byte> GetMemory(int sizeHint = 0)
参数
类型 | 名称 | 描述 |
---|---|---|
int | sizeHint | The minimum length of the returned Memory<T>. If 0, a non-empty buffer is returned. |
返回
类型 | 描述 |
---|---|
Memory<byte> | A Memory<T> of at least the size |
异常
类型 | 条件 |
---|---|
OutOfMemoryException | The requested buffer size is not available. |
GetSpan(int)
Returns a Span<T> to write to that is at least the requested size (specified by sizeHint
).
声明
public Span<byte> GetSpan(int sizeHint = 0)
参数
类型 | 名称 | 描述 |
---|---|---|
int | sizeHint | The minimum length of the returned Span<T>. If 0, a non-empty buffer is returned. |
返回
类型 | 描述 |
---|---|
Span<byte> | A Span<T> of at least the size |