RandomAccessStreamOverStream RandomAccessStreamOverStream RandomAccessStreamOverStream RandomAccessStreamOverStream Class

Definition

Provides a Windows Runtime random access stream for an IStream base implementation.

public : sealed class RandomAccessStreamOverStream : IClosable, IInputStream, IOutputStream, IRandomAccessStream
public sealed class RandomAccessStreamOverStream : IDisposable, IInputStream, IOutputStream, IRandomAccessStream
Public NotInheritable Class RandomAccessStreamOverStream Implements IDisposable, IInputStream, IOutputStream, IRandomAccessStream
// This class does not provide a public constructor.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

The InputStreamOverStream, OutputStreamOverStream, and RandomAccessStreamOverStream classes are interop helpers to convert between the Windows Runtime stream types, which are natively asynchronous, and the Component Object Model (COM) IStream types, which are natively synchronous.

These helper classes make it easier for to reuse legacy code when you transition to the Windows Runtime stream types.

Properties

CanRead CanRead CanRead CanRead

Gets a value that indicates whether the stream can be read from.

public : Platform::Boolean CanRead { get; }
public bool CanRead { get; }
Public ReadOnly Property CanRead As bool
var bool = randomAccessStreamOverStream.canRead;
Value
Platform::Boolean bool bool bool

True if the stream can be read from. Otherwise, false.

CanWrite CanWrite CanWrite CanWrite

Gets a value that indicates whether the stream can be written to.

public : Platform::Boolean CanWrite { get; }
public bool CanWrite { get; }
Public ReadOnly Property CanWrite As bool
var bool = randomAccessStreamOverStream.canWrite;
Value
Platform::Boolean bool bool bool

True if the stream can be written to. Otherwise, false.

Position Position Position Position

Gets the byte offset of the stream.

public : ulong Position { get; }
public ulong Position { get; }
Public ReadOnly Property Position As ulong
var ulong = randomAccessStreamOverStream.position;
Value
ulong ulong ulong ulong

The number of bytes from the start of the stream.

Size Size Size Size

Gets or sets the size of the random access stream.

public : ulong Size { get; set; }
public ulong Size { get; set; }
Public ReadWrite Property Size As ulong
var ulong = randomAccessStreamOverStream.size;
randomAccessStreamOverStream.size = ulong;
Value
ulong ulong ulong ulong

The size of the stream.

Methods

CloneStream() CloneStream() CloneStream() CloneStream()

Creates a new instance of a IRandomAccessStream over the same resource as the current stream.

public : IRandomAccessStream CloneStream()
public IRandomAccessStream CloneStream()
Public Function CloneStream() As IRandomAccessStream
var iRandomAccessStream = randomAccessStreamOverStream.cloneStream();
Returns

The new stream. The initial, internal position of the stream is 0.

The internal position and lifetime of this new stream are independent from the position and lifetime of the cloned stream.

Close() Close() Close() Close()

Closes the current stream and releases system resources.

public : void Close()
This member is not implemented in C#
This member is not implemented in VB.Net
randomAccessStreamOverStream.close();

Dispose() Dispose() Dispose() Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

This member is not implemented in C++
void Dispose()
Sub Dispose
void Dispose()

FlushAsync() FlushAsync() FlushAsync() FlushAsync()

Flushes data asynchronously in a sequential stream.

public : IAsyncOperation<Platform::Boolean> FlushAsync()
public IAsyncOperation<bool> FlushAsync()
Public Function FlushAsync() As IAsyncOperation( Of bool )
Windows.Storage.Streams.RandomAccessStreamOverStream.flushAsync().done( /* Your success and error handlers */ );
Returns

The stream flush operation.

Remarks

The FlushAsync method may produce latencies and does not always guarantee durable and coherent storage of data. It's generally recommended to avoid this method if possible.

GetInputStreamAt(UInt64) GetInputStreamAt(UInt64) GetInputStreamAt(UInt64) GetInputStreamAt(UInt64)

Returns an input stream at a specified location in a stream.

public : IInputStream GetInputStreamAt(unsigned __int64 position)
public IInputStream GetInputStreamAt(UInt64 position)
Public Function GetInputStreamAt(position As UInt64) As IInputStream
var iInputStream = randomAccessStreamOverStream.getInputStreamAt(position);
Parameters
position
unsigned __int64 UInt64 UInt64 UInt64

The location in the stream at which to begin.

Returns

GetOutputStreamAt(UInt64) GetOutputStreamAt(UInt64) GetOutputStreamAt(UInt64) GetOutputStreamAt(UInt64)

Returns an output stream at a specified location in a stream.

public : IOutputStream GetOutputStreamAt(unsigned __int64 position)
public IOutputStream GetOutputStreamAt(UInt64 position)
Public Function GetOutputStreamAt(position As UInt64) As IOutputStream
var iOutputStream = randomAccessStreamOverStream.getOutputStreamAt(position);
Parameters
position
unsigned __int64 UInt64 UInt64 UInt64

The location in the output stream at which to begin.

Returns

ReadAsync(IBuffer, UInt32, InputStreamOptions) ReadAsync(IBuffer, UInt32, InputStreamOptions) ReadAsync(IBuffer, UInt32, InputStreamOptions) ReadAsync(IBuffer, UInt32, InputStreamOptions)

Returns an asynchronous byte reader object.

public : IAsyncOperationWithProgress<IBuffer, unsigned int> ReadAsync(IBuffer buffer, unsigned int count, InputStreamOptions options)
public IAsyncOperationWithProgress<IBuffer, uint> ReadAsync(IBuffer buffer, UInt32 count, InputStreamOptions options)
Public Function ReadAsync(buffer As IBuffer, count As UInt32, options As InputStreamOptions) As IAsyncOperationWithProgress( Of IBuffer )( Of uint )
Windows.Storage.Streams.RandomAccessStreamOverStream.readAsync(buffer, count, options).done( /* Your success and error handlers */ );
Parameters
buffer
IBuffer IBuffer IBuffer IBuffer

The buffer into which the asynchronous read operation places the bytes that are read.

count
unsigned int UInt32 UInt32 UInt32

The number of bytes to read that is less than or equal to the Capacity value.

options
InputStreamOptions InputStreamOptions InputStreamOptions InputStreamOptions

Specifies the type of the asynchronous read operation.

Returns

Seek(UInt64) Seek(UInt64) Seek(UInt64) Seek(UInt64)

Sets the position of the stream to the specified value.

public : void Seek(unsigned __int64 position)
public void Seek(UInt64 position)
Public Function Seek(position As UInt64) As void
randomAccessStreamOverStream.seek(position);
Parameters
position
unsigned __int64 UInt64 UInt64 UInt64

The new position of the stream.

Remarks

Warning

This method does not check the position to make sure the value is valid for the stream. If the position is invalid for the stream, the ReadAsync and WriteAsync methods will return an error if you call them.

WriteAsync(IBuffer) WriteAsync(IBuffer) WriteAsync(IBuffer) WriteAsync(IBuffer)

Writes data asynchronously in a sequential stream.

public : IAsyncOperationWithProgress<unsigned int, unsigned int> WriteAsync(IBuffer buffer)
public IAsyncOperationWithProgress<uint, uint> WriteAsync(IBuffer buffer)
Public Function WriteAsync(buffer As IBuffer) As IAsyncOperationWithProgress( Of uint )( Of uint )
Windows.Storage.Streams.RandomAccessStreamOverStream.writeAsync(buffer).done( /* Your success and error handlers */ );
Parameters
buffer
IBuffer IBuffer IBuffer IBuffer

The buffer into which the asynchronous writer operation writes.

Returns

The byte writer operation.

See Also