WindowsRuntimeBufferExtensions.GetWindowsRuntimeBuffer 方法
定義
多載
GetWindowsRuntimeBuffer(MemoryStream) |
傳回代表與指定之記憶體串流相同之記憶體的 Windows.Storage.Streams.IBuffer 介面。Returns a Windows.Storage.Streams.IBuffer interface that represents the same memory as the specified memory stream. |
GetWindowsRuntimeBuffer(MemoryStream, Int32, Int32) |
傳回 Windows.Storage.Streams.IBuffer 介面,表示記憶體內指定記憶體資料流所代表的區域。Returns a Windows.Storage.Streams.IBuffer interface that represents a region within the memory that the specified memory stream represents. |
GetWindowsRuntimeBuffer(MemoryStream)
重要
此 API 不符合 CLS 規範。
傳回代表與指定之記憶體串流相同之記憶體的 Windows.Storage.Streams.IBuffer 介面。Returns a Windows.Storage.Streams.IBuffer interface that represents the same memory as the specified memory stream.
public:
[System::Runtime::CompilerServices::Extension]
static Windows::Storage::Streams::IBuffer ^ GetWindowsRuntimeBuffer(System::IO::MemoryStream ^ underlyingStream);
[System.CLSCompliant(false)]
public static Windows.Storage.Streams.IBuffer GetWindowsRuntimeBuffer (this System.IO.MemoryStream underlyingStream);
static member GetWindowsRuntimeBuffer : System.IO.MemoryStream -> Windows.Storage.Streams.IBuffer
<Extension()>
Public Function GetWindowsRuntimeBuffer (underlyingStream As MemoryStream) As IBuffer
參數
- underlyingStream
- MemoryStream
為 IBuffer 提供支援記憶體的資料流。The stream that provides the backing memory for the IBuffer.
傳回
由支援指定記憶體串流之相同記憶體支援的 Windows.Storage.Streams.IBuffer 介面。A Windows.Storage.Streams.IBuffer interface that is backed by the same memory that backs the specified memory stream.
- 屬性
GetWindowsRuntimeBuffer(MemoryStream, Int32, Int32)
重要
此 API 不符合 CLS 規範。
傳回 Windows.Storage.Streams.IBuffer 介面,表示記憶體內指定記憶體資料流所代表的區域。Returns a Windows.Storage.Streams.IBuffer interface that represents a region within the memory that the specified memory stream represents.
public:
[System::Runtime::CompilerServices::Extension]
static Windows::Storage::Streams::IBuffer ^ GetWindowsRuntimeBuffer(System::IO::MemoryStream ^ underlyingStream, int positionInStream, int length);
[System.CLSCompliant(false)]
public static Windows.Storage.Streams.IBuffer GetWindowsRuntimeBuffer (this System.IO.MemoryStream underlyingStream, int positionInStream, int length);
static member GetWindowsRuntimeBuffer : System.IO.MemoryStream * int * int -> Windows.Storage.Streams.IBuffer
<Extension()>
Public Function GetWindowsRuntimeBuffer (underlyingStream As MemoryStream, positionInStream As Integer, length As Integer) As IBuffer
參數
- underlyingStream
- MemoryStream
和 IBuffer 共用記憶體的資料流。The stream that shares memory with the IBuffer.
- positionInStream
- Int32
underlyingStream
中的共用記憶體區域位置。The position of the shared memory region in underlyingStream
.
- length
- Int32
共用記憶體區域大小上限。The maximum size of the shared memory region. 如果 underlyingStream
中的位元組數 (從 positionInStream
開始) 小於 length
,則傳回的 IBuffer 代表可用位元組數。If the number of bytes in underlyingStream
, starting at positionInStream
, is less than length
, the IBuffer that is returned represents only the available bytes.
傳回
由支援指定記憶體串流內之區域支援的 Windows.Storage.Streams.IBuffer 介面。A Windows.Storage.Streams.IBuffer interface that is backed by a region within the memory that backs the specified memory stream.
- 屬性
例外狀況
underlyingStream
為 null。underlyingStream
is null.
positionInStream
或 length
小於 0 (零)。positionInStream
or length
is less than 0 (zero).
positionInStream
超出 source
的結尾。positionInStream
is beyond the end of source
.
underlyingStream
無法公開其基礎記憶體緩衝區。underlyingStream
cannot expose its underlying memory buffer.
這個 underlyingStream
已關閉。underlyingStream
has been closed.