MemoryMappedViewAccessor 類別

定義

表示記憶體對應檔的隨機存取檢視。

public ref class MemoryMappedViewAccessor sealed : System::IO::UnmanagedMemoryAccessor
public sealed class MemoryMappedViewAccessor : System.IO.UnmanagedMemoryAccessor
type MemoryMappedViewAccessor = class
    inherit UnmanagedMemoryAccessor
Public NotInheritable Class MemoryMappedViewAccessor
Inherits UnmanagedMemoryAccessor
繼承
MemoryMappedViewAccessor

範例

下列範例會 MemoryMappedViewAccessor 從大型記憶體對應檔案取得 以進行編輯。

此程式碼範例是提供給 類別之較大範例的 MemoryMappedFile 一部分。

// Create a random access view, from the 256th megabyte (the offset)
// to the 768th megabyte (the offset plus length).
using (var accessor = mmf.CreateViewAccessor(offset, length))
{
    int colorSize = Marshal.SizeOf(typeof(MyColor));
    MyColor color;

    // Make changes to the view.
    for (long i = 0; i < length; i += colorSize)
    {
        accessor.Read(i, out color);
        color.Brighten(10);
        accessor.Write(i, ref color);
    }
}
' Create a random access view, from the 256th megabyte (the offset)
' to the 768th megabyte (the offset plus length).
Using accessor = mmf.CreateViewAccessor(offset, length)
    Dim colorSize As Integer = Marshal.SizeOf(GetType(MyColor))
    Dim color As MyColor
    Dim i As Long = 0

    ' Make changes to the view.
    Do While (i < length)
        accessor.Read(i, color)
        color.Brighten(10)
        accessor.Write(i, color)
        i += colorSize
    Loop
End Using

備註

CreateViewAccessor使用 物件的 方法來 MemoryMappedFile 取得此檢視。

屬性

CanRead

判斷存取子是否可讀取。

(繼承來源 UnmanagedMemoryAccessor)
CanWrite

判斷存取子是否可寫入。

(繼承來源 UnmanagedMemoryAccessor)
Capacity

取得存取子的容量。

(繼承來源 UnmanagedMemoryAccessor)
IsOpen

判斷存取子目前是否由處理程序開啟。

(繼承來源 UnmanagedMemoryAccessor)
PointerOffset

取得這個檢視起始位置與記憶體對應檔案開頭的位移位元組數目。

SafeMemoryMappedViewHandle

取得記憶體對應檔檢視的控制代碼。

方法

Dispose()

釋放 UnmanagedMemoryAccessor 所使用的所有資源。

(繼承來源 UnmanagedMemoryAccessor)
Dispose(Boolean)

釋放 UnmanagedMemoryAccessor 所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。

(繼承來源 UnmanagedMemoryAccessor)
Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
Flush()

清除這個檢視的所有緩衝區,並造成任何緩衝資料都寫入基礎檔案。

GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
Initialize(SafeBuffer, Int64, Int64, FileAccess)

設定存取子的初始值。

(繼承來源 UnmanagedMemoryAccessor)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
Read<T>(Int64, T)

將型別 T 的結構從存取子讀入至提供的參考。

(繼承來源 UnmanagedMemoryAccessor)
ReadArray<T>(Int64, T[], Int32, Int32)

將型別 T 的結構從存取子讀入至型別 T 的陣列。

(繼承來源 UnmanagedMemoryAccessor)
ReadBoolean(Int64)

從存取子讀取布林值。

(繼承來源 UnmanagedMemoryAccessor)
ReadByte(Int64)

從存取子讀取位元組值。

(繼承來源 UnmanagedMemoryAccessor)
ReadChar(Int64)

從存取子讀取位元組值。

(繼承來源 UnmanagedMemoryAccessor)
ReadDecimal(Int64)

從存取子讀取位元組值。

(繼承來源 UnmanagedMemoryAccessor)
ReadDouble(Int64)

從存取子讀取雙精確度浮點數值。

(繼承來源 UnmanagedMemoryAccessor)
ReadInt16(Int64)

從存取子讀取 16 位元整數。

(繼承來源 UnmanagedMemoryAccessor)
ReadInt32(Int64)

從存取子讀取 32 位元整數。

(繼承來源 UnmanagedMemoryAccessor)
ReadInt64(Int64)

從存取子讀取 64 位元整數。

(繼承來源 UnmanagedMemoryAccessor)
ReadSByte(Int64)

從存取子讀取 8 位元帶正負號的整數。

(繼承來源 UnmanagedMemoryAccessor)
ReadSingle(Int64)

從存取子讀取單精確度浮點數值。

(繼承來源 UnmanagedMemoryAccessor)
ReadUInt16(Int64)

從存取子讀取不帶正負號的 16 位元整數。

(繼承來源 UnmanagedMemoryAccessor)
ReadUInt32(Int64)

從存取子讀取不帶正負號的 32 位元整數。

(繼承來源 UnmanagedMemoryAccessor)
ReadUInt64(Int64)

從存取子讀取不帶正負號的 64 位元整數。

(繼承來源 UnmanagedMemoryAccessor)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)
Write(Int64, Boolean)

將布林值寫入至存取子。

(繼承來源 UnmanagedMemoryAccessor)
Write(Int64, Byte)

將位元組值寫入至存取子。

(繼承來源 UnmanagedMemoryAccessor)
Write(Int64, Char)

將字元寫入至存取子。

(繼承來源 UnmanagedMemoryAccessor)
Write(Int64, Decimal)

將十進位值寫入至存取子。

(繼承來源 UnmanagedMemoryAccessor)
Write(Int64, Double)

Double 值寫入至存取子。

(繼承來源 UnmanagedMemoryAccessor)
Write(Int64, Int16)

將 16 位元整數寫入至存取子。

(繼承來源 UnmanagedMemoryAccessor)
Write(Int64, Int32)

將 32 位元整數寫入至存取子。

(繼承來源 UnmanagedMemoryAccessor)
Write(Int64, Int64)

將 64 位元整數寫入至存取子。

(繼承來源 UnmanagedMemoryAccessor)
Write(Int64, SByte)

將 8 位元整數寫入至存取子。

(繼承來源 UnmanagedMemoryAccessor)
Write(Int64, Single)

Single 寫入至存取子。

(繼承來源 UnmanagedMemoryAccessor)
Write(Int64, UInt16)

將不帶正負號的 16 位元整數寫入至存取子。

(繼承來源 UnmanagedMemoryAccessor)
Write(Int64, UInt32)

將不帶正負號的 32 位元整數寫入至存取子。

(繼承來源 UnmanagedMemoryAccessor)
Write(Int64, UInt64)

將不帶正負號的 64 位元整數寫入至存取子。

(繼承來源 UnmanagedMemoryAccessor)
Write<T>(Int64, T)

將結構寫入至存取子。

(繼承來源 UnmanagedMemoryAccessor)
WriteArray<T>(Int64, T[], Int32, Int32)

將結構從型別 T 的陣列寫入至存取子。

(繼承來源 UnmanagedMemoryAccessor)

適用於

另請參閱