MemoryMappedViewStream Class

.NET Framework (current version)
 

Represents a view of a memory-mapped file as a sequentially accessed stream.

Namespace:   System.IO.MemoryMappedFiles
Assembly:  System.Core (in System.Core.dll)

System::Object
  System::MarshalByRefObject
    System.IO::Stream
      System.IO::UnmanagedMemoryStream
        System.IO.MemoryMappedFiles::MemoryMappedViewStream

public ref class MemoryMappedViewStream sealed : UnmanagedMemoryStream

NameDescription
System_CAPS_pubpropertyCanRead

Gets a value indicating whether a stream supports reading.(Inherited from UnmanagedMemoryStream.)

System_CAPS_pubpropertyCanSeek

Gets a value indicating whether a stream supports seeking.(Inherited from UnmanagedMemoryStream.)

System_CAPS_pubpropertyCanTimeout

Gets a value that determines whether the current stream can time out.(Inherited from Stream.)

System_CAPS_pubpropertyCanWrite

Gets a value indicating whether a stream supports writing.(Inherited from UnmanagedMemoryStream.)

System_CAPS_pubpropertyCapacity

Gets the stream length (size) or the total amount of memory assigned to a stream (capacity).(Inherited from UnmanagedMemoryStream.)

System_CAPS_pubpropertyLength

Gets the length of the data in a stream.(Inherited from UnmanagedMemoryStream.)

System_CAPS_pubpropertyPointerOffset

[Supported in the .NET Framework 4.5.1 and later versions]

Gets the number of bytes by which the starting position of this view is offset from the beginning of the memory-mapped file.

System_CAPS_pubpropertyPosition

Gets or sets the current position in a stream.(Inherited from UnmanagedMemoryStream.)

System_CAPS_pubpropertyPositionPointer

Gets or sets a byte pointer to a stream based on the current position in the stream.(Inherited from UnmanagedMemoryStream.)

System_CAPS_pubpropertyReadTimeout

Gets or sets a value, in miliseconds, that determines how long the stream will attempt to read before timing out. (Inherited from Stream.)

System_CAPS_pubpropertySafeMemoryMappedViewHandle

Gets a handle to the view of a memory-mapped file.

System_CAPS_pubpropertyWriteTimeout

Gets or sets a value, in miliseconds, that determines how long the stream will attempt to write before timing out. (Inherited from Stream.)

NameDescription
System_CAPS_pubmethodBeginRead(array<Byte>^, Int32, Int32, AsyncCallback^, Object^)

Begins an asynchronous read operation. (Consider using ReadAsync instead; see the Remarks section.)(Inherited from Stream.)

System_CAPS_pubmethodBeginWrite(array<Byte>^, Int32, Int32, AsyncCallback^, Object^)

Begins an asynchronous write operation. (Consider using WriteAsync instead; see the Remarks section.)(Inherited from Stream.)

System_CAPS_pubmethodClose()

Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream. Instead of calling this method, ensure that the stream is properly disposed.(Inherited from Stream.)

System_CAPS_pubmethodCopyTo(Stream^)

Reads the bytes from the current stream and writes them to another stream.(Inherited from Stream.)

System_CAPS_pubmethodCopyTo(Stream^, Int32)

Reads the bytes from the current stream and writes them to another stream, using a specified buffer size.(Inherited from Stream.)

System_CAPS_pubmethodCopyToAsync(Stream^)

Asynchronously reads the bytes from the current stream and writes them to another stream.(Inherited from Stream.)

System_CAPS_pubmethodCopyToAsync(Stream^, Int32)

Asynchronously reads the bytes from the current stream and writes them to another stream, using a specified buffer size.(Inherited from Stream.)

System_CAPS_pubmethodCopyToAsync(Stream^, Int32, CancellationToken)

Asynchronously reads the bytes from the current stream and writes them to another stream, using a specified buffer size and cancellation token.(Inherited from Stream.)

System_CAPS_pubmethodCreateObjRef(Type^)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodDispose()

Releases all resources used by the Stream.(Inherited from Stream.)

System_CAPS_pubmethodEndRead(IAsyncResult^)

Waits for the pending asynchronous read to complete. (Consider using ReadAsync instead; see the Remarks section.)(Inherited from Stream.)

System_CAPS_pubmethodEndWrite(IAsyncResult^)

Ends an asynchronous write operation. (Consider using WriteAsync instead; see the Remarks section.)(Inherited from Stream.)

System_CAPS_pubmethodEquals(Object^)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodFlush()

Clears all buffers for this stream and causes any buffered data to be written to the underlying file.(Overrides UnmanagedMemoryStream::Flush().)

System_CAPS_pubmethodFlushAsync()

Asynchronously clears all buffers for this stream and causes any buffered data to be written to the underlying device.(Inherited from Stream.)

System_CAPS_pubmethodFlushAsync(CancellationToken)

Overrides the Stream::FlushAsync method so that the operation is cancelled if specified, but no other action is performed.

Available starting in .NET Framework 4.6(Inherited from UnmanagedMemoryStream.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetLifetimeService()

Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodInitializeLifetimeService()

Obtains a lifetime service object to control the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodRead(array<Byte>^, Int32, Int32)

Reads the specified number of bytes into the specified array.(Inherited from UnmanagedMemoryStream.)

System_CAPS_pubmethodReadAsync(array<Byte>^, Int32, Int32)

Asynchronously reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.(Inherited from Stream.)

System_CAPS_pubmethodReadAsync(array<Byte>^, Int32, Int32, CancellationToken)

Asynchronously reads the specified number of bytes into the specified array.

Available starting in .NET Framework 4.6(Inherited from UnmanagedMemoryStream.)

System_CAPS_pubmethodReadByte()

Reads a byte from a stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.(Inherited from UnmanagedMemoryStream.)

System_CAPS_pubmethodSeek(Int64, SeekOrigin)

Sets the current position of the current stream to the given value.(Inherited from UnmanagedMemoryStream.)

System_CAPS_pubmethodSetLength(Int64)

This API supports the product infrastructure and is not intended to be used directly from your code. Sets the length of the current stream.(Overrides UnmanagedMemoryStream::SetLength(Int64).)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_pubmethodWrite(array<Byte>^, Int32, Int32)

Writes a block of bytes to the current stream using data from a buffer.(Inherited from UnmanagedMemoryStream.)

System_CAPS_pubmethodWriteAsync(array<Byte>^, Int32, Int32)

Asynchronously writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.(Inherited from Stream.)

System_CAPS_pubmethodWriteAsync(array<Byte>^, Int32, Int32, CancellationToken)

Asynchronously writes a sequence of bytes to the current stream, advances the current position within this stream by the number of bytes written, and monitors cancellation requests.

Available starting in .NET Framework 4.6(Inherited from UnmanagedMemoryStream.)

System_CAPS_pubmethodWriteByte(Byte)

Writes a byte to the current position in the file stream.(Inherited from UnmanagedMemoryStream.)

Use the CreateViewStream method of a MemoryMappedFile object to get this stream.

The following example obtains a MemoryMappedViewStream of a memory-mapped file and writes a value to the stream for inter-process communication.

This code example is part of a larger example provided for the MemoryMappedFile::CreateNew method.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 4.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: