Buffer 类

定义

提供 IBuffer 接口及其相关接口的默认实现。

public ref class Buffer sealed : IBuffer
/// [Windows.Foundation.Metadata.Activatable(Windows.Storage.Streams.IBufferFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class Buffer final : IBuffer
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(Windows.Storage.Streams.IBufferFactory, 65536, "Windows.Foundation.UniversalApiContract")]
class Buffer final : IBuffer
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Storage.Streams.IBufferFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class Buffer : IBuffer
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Storage.Streams.IBufferFactory), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class Buffer : IBuffer
function Buffer(capacity)
Public NotInheritable Class Buffer
Implements IBuffer
继承
Object Platform::Object IInspectable Buffer
属性
实现

Windows 要求

设备系列
Windows 10 (在 10.0.10240.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)

注解

有关详细信息,请参阅 创建、写入和读取文件,其中演示如何使用 Buffer 读取和写入文件字节。

构造函数

Buffer(UInt32)

使用指定的容量初始化 Buffer 类的新实例。

属性

Capacity

获取缓冲区可以容纳的最大字节数。

Length

获取缓冲区中当前正在使用的字节数。

方法

CreateCopyFromMemoryBuffer(IMemoryBuffer)

创建包含指定缓冲区副本的新缓冲区。

CreateMemoryBufferOverIBuffer(IBuffer)

从现有 IBuffer 创建 MemoryBuffer

适用于

另请参阅