Struct MemoryMappedDirectAccessor
Provides direct access to the memory-mapped file content through pointer to its virtual memory.
Namespace: DotNext.IO.MemoryMappedFiles
Assembly: DotNext.Unsafe.dll
Syntax
public struct MemoryMappedDirectAccessor : IUnmanagedMemory, IDisposable
Properties
| Improve this Doc View SourceBytes
Represents memory-mapped file segment in the form of
Declaration
public Span<byte> Bytes { get; }
Property Value
| Type | Description |
|---|---|
| Span<Byte> |
IsEmpty
Gets a value indicating that this object doesn't represent the memory-mapped file segment.
Declaration
public bool IsEmpty { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
Offset
Gets the number of bytes by which the starting position of this segment is offset from the beginning of the memory-mapped file.
Declaration
public long Offset { get; }
Property Value
| Type | Description |
|---|---|
| Int64 |
Pointer
Gets pointer to the virtual memory of the mapped file.
Declaration
public Pointer<byte> Pointer { get; }
Property Value
| Type | Description |
|---|---|
| Pointer<Byte> | The pointer to the memory-mapped file. |
Size
Gets length of the mapped segment.
Declaration
public long Size { get; }
Property Value
| Type | Description |
|---|---|
| Int64 |
Methods
| Improve this Doc View SourceAsStream()
Converts the segment of the memory-mapped file
Declaration
public Stream AsStream()
Returns
| Type | Description |
|---|---|
| Stream | The stream representing virtual memory of the memory-mapped file. |
Remarks
The caller is responsible for disposing of the returned stream.
Clear()
Sets all bits of allocated memory to zero.
Declaration
public void Clear()
Dispose()
Releases virtual memory associated with the mapped file segment.
Declaration
public void Dispose()
Flush()
Clears all buffers for this view and causes any buffered data to be written to the underlying file.
Declaration
public void Flush()