Buffer Buffer Buffer Buffer Class

Provides a default implementation of the IBuffer interface and its related interfaces.

Syntax

Declaration

public sealed class Bufferpublic sealed class BufferPublic NotInheritable Class Bufferpublic sealed class Buffer

Remarks

For more info, see Quickstart: Reading and writing a file, which shows how to read and write bytes to a file by using a Buffer.

Constructors summary

Initializes a new instance of the Buffer class with the specified capacity.

Properties summary

Gets the maximum number of bytes that the buffer can hold.

Gets the number of bytes currently in use in the buffer.

Methods summary

Creates a new buffer containing a copy of a specified buffer.

Creates a MemoryBuffer from an existing IBuffer.

Constructors

  • Buffer(UInt32)
    Buffer(UInt32)
    Buffer(UInt32)
    Buffer(UInt32)

    Initializes a new instance of the Buffer class with the specified capacity.

    public Buffer(UInt32 capacity)public New(UInt32 capacity)Public Sub New(capacity As UInt32)public Buffer(UInt32 capacity)

    Parameters

    • capacity
      System.UInt32
      System.UInt32
      System.UInt32
      System.UInt32

      The maximum number of bytes that the buffer can hold.

Properties

  • Capacity
    Capacity
    Capacity
    Capacity

    Gets the maximum number of bytes that the buffer can hold.

    public uint Capacity { get; }public uint Capacity { get; }Public ReadOnly Property Capacity As uintpublic uint Capacity { get; }

    Property Value

    • uint
      uint
      uint
      uint

      The maximum number of bytes that the buffer can hold.

  • Length
    Length
    Length
    Length

    Gets the number of bytes currently in use in the buffer.

    public uint Length { get; set; }public uint Length { get; set; }Public ReadWrite Property Length As uintpublic uint Length { get; set; }

    Property Value

    • uint
      uint
      uint
      uint

      The number of bytes currently in use in the buffer, which is less than or equal to the capacity of the buffer.

Methods

  • CreateCopyFromMemoryBuffer(IMemoryBuffer)
    CreateCopyFromMemoryBuffer(IMemoryBuffer)
    CreateCopyFromMemoryBuffer(IMemoryBuffer)
    CreateCopyFromMemoryBuffer(IMemoryBuffer)

    Creates a new buffer containing a copy of a specified buffer.

    public static Buffer CreateCopyFromMemoryBuffer(IMemoryBuffer input)public static Buffer CreateCopyFromMemoryBuffer(IMemoryBuffer input)Public Static Function CreateCopyFromMemoryBuffer(input As IMemoryBuffer) As Bufferpublic static Buffer CreateCopyFromMemoryBuffer(IMemoryBuffer input)

    Parameters

    Returns

  • CreateMemoryBufferOverIBuffer(IBuffer)
    CreateMemoryBufferOverIBuffer(IBuffer)
    CreateMemoryBufferOverIBuffer(IBuffer)
    CreateMemoryBufferOverIBuffer(IBuffer)

    Creates a MemoryBuffer from an existing IBuffer.

    public static MemoryBuffer CreateMemoryBufferOverIBuffer(IBuffer input)public static MemoryBuffer CreateMemoryBufferOverIBuffer(IBuffer input)Public Static Function CreateMemoryBufferOverIBuffer(input As IBuffer) As MemoryBufferpublic static MemoryBuffer CreateMemoryBufferOverIBuffer(IBuffer input)

    Parameters

    Returns

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ActivatableAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.MuseAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.ThreadingAttribute

Details

Assembly

Windows.Storage.Streams.dll