FileRandomAccessStream FileRandomAccessStream FileRandomAccessStream FileRandomAccessStream Class

Supports reading and writing to a file at a specified position.

Syntax

Declaration

public sealed class FileRandomAccessStreampublic sealed class FileRandomAccessStreamPublic NotInheritable Class FileRandomAccessStream

Properties summary

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

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

Gets the byte offset of the stream.

Gets or sets the size of the random access stream.

Methods summary

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

Closes the current stream and releases system resources.

Flushes data asynchronously in a sequential stream.

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

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

Returns an asynchronous byte reader object.

Sets the position of the stream to the specified value.

Writes data asynchronously to a file.

Properties

  • CanRead
    CanRead
    CanRead
    CanRead

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

    public bool CanRead { get; }public bool CanRead { get; }Public ReadOnly Property CanRead As bool

    Property Value

    • bool
      bool
      bool
      bool

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

  • CanWrite
    CanWrite
    CanWrite
    CanWrite

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

    public bool CanWrite { get; }public bool CanWrite { get; }Public ReadOnly Property CanWrite As bool

    Property Value

    • bool
      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

    Property 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

    Property 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

    Returns

  • Close()
    Close()
    Close()
    Close()

    Closes the current stream and releases system resources.

    public void Close()public void Close()Public Function Close() As void
  • FlushAsync()
    FlushAsync()
    FlushAsync()
    FlushAsync()

    Flushes data asynchronously in a sequential stream.

    public IAsyncOperation<bool> FlushAsync()public IAsyncOperation<bool> FlushAsync()Public Function FlushAsync() As IAsyncOperation( Of bool )

    Returns

    • The stream flush operation.

  • GetInputStreamAt(System.UInt64)
    GetInputStreamAt(System.UInt64)
    GetInputStreamAt(System.UInt64)
    GetInputStreamAt(System.UInt64)

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

    public IInputStream GetInputStreamAt(System.UInt64 position)public IInputStream GetInputStreamAt(System.UInt64 position)Public Function GetInputStreamAt(position As System.UInt64) As IInputStream

    Parameters

    • position
      System.UInt64
      System.UInt64
      System.UInt64
      System.UInt64

      The location in the stream at which to begin.

    Returns

  • GetOutputStreamAt(System.UInt64)
    GetOutputStreamAt(System.UInt64)
    GetOutputStreamAt(System.UInt64)
    GetOutputStreamAt(System.UInt64)

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

    public IOutputStream GetOutputStreamAt(System.UInt64 position)public IOutputStream GetOutputStreamAt(System.UInt64 position)Public Function GetOutputStreamAt(position As System.UInt64) As IOutputStream

    Parameters

    • position
      System.UInt64
      System.UInt64
      System.UInt64
      System.UInt64

      The location in the output stream at which to begin.

    Returns

  • ReadAsync(Windows.Storage.Streams.IBuffer,System.UInt32,Windows.Storage.Streams.InputStreamOptions)
    ReadAsync(Windows.Storage.Streams.IBuffer,System.UInt32,Windows.Storage.Streams.InputStreamOptions)
    ReadAsync(Windows.Storage.Streams.IBuffer,System.UInt32,Windows.Storage.Streams.InputStreamOptions)
    ReadAsync(Windows.Storage.Streams.IBuffer,System.UInt32,Windows.Storage.Streams.InputStreamOptions)

    Returns an asynchronous byte reader object.

    public IAsyncOperationWithProgress<IBuffer, uint> ReadAsync(Windows.Storage.Streams.IBuffer buffer,System.UInt32 count,Windows.Storage.Streams.InputStreamOptions options)public IAsyncOperationWithProgress<IBuffer, uint> ReadAsync(Windows.Storage.Streams.IBuffer buffer,System.UInt32 count,Windows.Storage.Streams.InputStreamOptions options)Public Function ReadAsync(buffer As Windows.Storage.Streams.IBuffer,count As System.UInt32,options As Windows.Storage.Streams.InputStreamOptions) As IAsyncOperationWithProgress( Of IBuffer, uint )

    Parameters

    Returns

    • The asynchronous operation.

  • Seek(System.UInt64)
    Seek(System.UInt64)
    Seek(System.UInt64)
    Seek(System.UInt64)

    Sets the position of the stream to the specified value.

    public void Seek(System.UInt64 position)public void Seek(System.UInt64 position)Public Function Seek(position As System.UInt64) As void

    Parameters

    • position
      System.UInt64
      System.UInt64
      System.UInt64
      System.UInt64

      The new position of the stream.

  • WriteAsync(Windows.Storage.Streams.IBuffer)
    WriteAsync(Windows.Storage.Streams.IBuffer)
    WriteAsync(Windows.Storage.Streams.IBuffer)
    WriteAsync(Windows.Storage.Streams.IBuffer)

    Writes data asynchronously to a file.

    public IAsyncOperationWithProgress<uint, uint> WriteAsync(Windows.Storage.Streams.IBuffer buffer)public IAsyncOperationWithProgress<uint, uint> WriteAsync(Windows.Storage.Streams.IBuffer buffer)Public Function WriteAsync(buffer As Windows.Storage.Streams.IBuffer) As IAsyncOperationWithProgress( Of uint, uint )

    Parameters

    Returns

    • The byte writer operation.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.ContractVersionAttribute

Details

Assembly

Windows.Storage.Streams.dll