Show / Hide Table of Contents

Struct MemoryMappedDirectAccessor

Provides direct access to the memory-mapped file content through pointer to its virtual memory.

Implements
IUnmanagedMemory
IDisposable
ISupplier<Stream>
IFunctional<Func<Stream>>
IFlushable
Inherited Members
ValueType.Equals(object)
ValueType.GetHashCode()
ValueType.ToString()
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)
Namespace: DotNext.IO.MemoryMappedFiles
Assembly: DotNext.Unsafe.dll
Syntax
public struct MemoryMappedDirectAccessor : IUnmanagedMemory, IDisposable, ISupplier<Stream>, IFunctional<Func<Stream>>, IFlushable

Properties

| Edit this page View Source

Bytes

Represents memory-mapped file segment in the form of Span<T>.

Declaration
public readonly Span<byte> Bytes { get; }
Property Value
Type Description
Span<byte>

Span<T> representing virtual memory of the mapped file segment.

| Edit this page View Source

IsEmpty

Gets a value indicating that this object doesn't represent the memory-mapped file segment.

Declaration
public readonly bool IsEmpty { get; }
Property Value
Type Description
bool
| Edit this page View Source

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 readonly long Offset { get; }
Property Value
Type Description
long
| Edit this page View Source

Pointer

Gets pointer to the virtual memory of the mapped file.

Declaration
public readonly Pointer<byte> Pointer { get; }
Property Value
Type Description
Pointer<byte>

The pointer to the memory-mapped file.

| Edit this page View Source

Size

Gets length of the mapped segment, in bytes.

Declaration
public readonly long Size { get; }
Property Value
Type Description
long

Methods

| Edit this page View Source

AsStream()

Converts the segment of the memory-mapped file.

Declaration
public readonly 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.

| Edit this page View Source

Clear()

Sets all bits of allocated memory to zero.

Declaration
public readonly void Clear()
Exceptions
Type Condition
ObjectDisposedException

The underlying unmanaged memory is released.

| Edit this page View Source

Dispose()

Releases virtual memory associated with the mapped file segment.

Declaration
public void Dispose()
| Edit this page View Source

Flush()

Clears all buffers for this view and causes any buffered data to be written to the underlying file.

Declaration
public readonly void Flush()

Implements

IUnmanagedMemory
IDisposable
ISupplier<TResult>
IFunctional<TDelegate>
IFlushable

Extension Methods

BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, ReadOnlySpan<T>)
Collection.ToAsyncEnumerator<TEnumerator, T>(TEnumerator, CancellationToken)
Collection.ToClassicEnumerator<TEnumerator, T>(TEnumerator)
Enumerator.Skip<TEnumerator, T>(ref TEnumerator, int)
ExpressionBuilder.Const<T>(T)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾