IRandomAccessStreamReference IRandomAccessStreamReference IRandomAccessStreamReference IRandomAccessStreamReference Interface

Enables a Windows Runtime component to provide access to an encapsulated stream.

Syntax

Declaration

public interface IRandomAccessStreamReferencepublic interface IRandomAccessStreamReferencePublic Interface IRandomAccessStreamReferencepublic interface IRandomAccessStreamReference

Remarks

Implement the IRandomAccessStreamReference interface when your Windows Runtime component exposes a random access stream to callers. For a sequential read-only stream, implement the IInputStreamReference interface.

For example, a StorageFile provides an IRandomAccessStream for the contents of a file, so it implements the IRandomAccessStreamReference interface. Usually, providing a stream requires accessing the hard disk, so stream operations are asynchronous. Components that consume file content receive an IRandomAccessStreamReference instead of a StorageFile reference, because this interface is the more minimal requirement for the input parameter.

Important

Not all sources can provide random access streams efficiently. If a component requires only sequential read access, consider implementing the IInputStreamReference interface instead of the IRandomAccessStreamReference interface.

Methods summary

Opens a stream for random access.

Methods

  • OpenReadAsync()
    OpenReadAsync()
    OpenReadAsync()
    OpenReadAsync()

    Opens a stream for random access.

    public IAsyncOperation<IRandomAccessStreamWithContentType> OpenReadAsync()public IAsyncOperation<IRandomAccessStreamWithContentType> OpenReadAsync()Public Function OpenReadAsync() As IAsyncOperation( Of IRandomAccessStreamWithContentType )public IAsyncOperation<IRandomAccessStreamWithContentType> OpenReadAsync()

    Returns

    • The asynchronous operation.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.GuidAttribute

Details

Assembly

Windows.Storage.Streams.dll