Share via


ProtectedFileStream class

Used to access a protected file.

Syntax

public ref class ProtectedFileStream sealed : IRandomAccessStream

Members

The ProtectedFileStream class inherits from IRandomAccessStream. ProtectedFileStream also has these types of members:

Methods

The ProtectedFileStream class has these methods. It also inherits methods from the Object class.

Method Description
AcquireAsync Creates a ProtectedFileStream object from a backing stream.
CloneStream Creates a new instance of ProtectedFileStream over the protected file.
CreateAsync Creates a ProtectedFileStream from a UserPolicy object and a backing stream.
FlushAsync Flushes the data asynchronously to the protected file.
GetInputStreamAt Returns an input stream at the specified position in the protected file.
GetOutputStreamAt Returns an output stream at the specified location in the protected file.
ReadAsync Returns an asynchronous byte reader object.
Seek Sets the current position to the specified number of bytes from the start of the file.
WriteAsync Writes data asynchronously to the protected file.

Properties

The ProtectedFileStream class has these properties.

Property Access type Description
CanRead
Read-only
Gets a value that indicates whether the file can be read from. Implements the IRandomAccessStream.CanRead property.
CanWrite
Read-only
Gets a value that indicates whether the file can be written to. Implements the IRandomAccessStream.CanWrite property.
OriginalFileExtension
Read-only
Gets the filename extension of the original (unprotected) file.
Policy
Read-only
Gets user policy associated with this ProtectedFileStream object.
Position
Read-only
Gets the current file position in bytes.
Size
Read/write
Gets or sets the size of the protected data in bytes.

Remarks

ProtectedFileStream objects are used to open and create protected files and to read and write protected content from and to protected files. The ProtectedFileStream class implements the Windows.Storage.Streams.IRandomAccessStream interface so that apps can read and write from and to protected files as they would by using standard Windows Runtime streams. When you create a ProtectedFileStream, you specify a backing stream, an object of IRandomAccessStream, where the actual protected file is or should be stored.

Thread Safety

Members of this class are not guaranteed to be thread safe.

Requirements

Minimum supported client
None supported
Minimum supported server
None supported
Minimum supported phone
Windows Phone 8.1
Namespace
Microsoft::RightsManagement
Metadata
Microsoft.RightsManagement.winmd

See also

IRandomAccessStream