Aracılığıyla paylaş


FileRandomAccessStream Class

Definition

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

public ref class FileRandomAccessStream sealed : IClosable, IRandomAccessStream
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class FileRandomAccessStream final : IClosable, IRandomAccessStream
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class FileRandomAccessStream : System.IDisposable, IRandomAccessStream
Public NotInheritable Class FileRandomAccessStream
Implements IDisposable, IRandomAccessStream
Inheritance
Object Platform::Object IInspectable FileRandomAccessStream
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

Version history

Windows version SDK version Value added
1709 16299 OpenAsync(String,FileAccessMode)
1709 16299 OpenAsync(String,FileAccessMode,StorageOpenOptions,FileOpenDisposition)
1709 16299 OpenForUserAsync(User,String,FileAccessMode)
1709 16299 OpenForUserAsync(User,String,FileAccessMode,StorageOpenOptions,FileOpenDisposition)
1709 16299 OpenTransactedWriteAsync(String)
1709 16299 OpenTransactedWriteAsync(String,StorageOpenOptions,FileOpenDisposition)
1709 16299 OpenTransactedWriteForUserAsync(User,String)
1709 16299 OpenTransactedWriteForUserAsync(User,String,StorageOpenOptions,FileOpenDisposition)

Properties

CanRead

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

CanWrite

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

Position

Gets the byte offset of the stream.

Size

Gets or sets the size of the random access stream.

Methods

CloneStream()

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

Close()

Closes the current stream and releases system resources.

Dispose()

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

FlushAsync()

Flushes data asynchronously in a sequential stream.

GetInputStreamAt(UInt64)

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

GetOutputStreamAt(UInt64)

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

OpenAsync(String, FileAccessMode, StorageOpenOptions, FileOpenDisposition)

Opens a stream to a file given a file path. If the file does not exist, it can be created using FileOpenDisposition.

OpenAsync(String, FileAccessMode)

Opens a stream to an existing file given the file's path.

OpenForUserAsync(User, String, FileAccessMode, StorageOpenOptions, FileOpenDisposition)

Opens a stream for a user to a file given a file path and the user's information. If the file does not exist, it can be created using FileOpenDisposition.

OpenForUserAsync(User, String, FileAccessMode)

Opens a stream for a user to an existing file given the file path and the user's information.

OpenTransactedWriteAsync(String, StorageOpenOptions, FileOpenDisposition)

Opens a stream for writing to a file given a file path. If the file does not exist, it can be created using FileOpenDisposition.

OpenTransactedWriteAsync(String)

Opens a stream for writing to an existing file given the file's path.

OpenTransactedWriteForUserAsync(User, String, StorageOpenOptions, FileOpenDisposition)

Opens a writable stream for a user to a file given a file path and the user's information. If the file does not exist, it can be created using FileOpenDisposition.

OpenTransactedWriteForUserAsync(User, String)

Opens a writable stream for a user to an existing file given the file's path and the user's information.

ReadAsync(IBuffer, UInt32, InputStreamOptions)

Returns an asynchronous byte reader object.

Seek(UInt64)

Sets the position of the stream to the specified value.

WriteAsync(IBuffer)

Writes data asynchronously to a file.

Applies to

See also