Compartilhar via


CustomProtectedStream class

Used to access files that use a custom protection format.

[!Important]
RMS applications that use CustomProtectedStream may be incompatible with SharePoint, Exchange, and other RMS applications. For most applications, it is recommended that you use ProtectedFileStream instead.

Syntax

public ref class CustomProtectedFileStream sealed : IRandomAccessStream

Members

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

Methods

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

Method Description
CloneStream Creates a new instance of CustomProtectedStream over the protected content.
CreateAsync Creates a CustomProtectedStream object based on the specified protection policy and a backing stream.
FlushAsync Flushes the data asynchronously to the backing file.
GetEncryptedContentLength Calculates the length of the encrypted content from the length of the clear content.
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 backing file.

Properties

The CustomProtectedFileStream 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.
Position
Read-only
Gets the current file position in bytes.
Size
Read/write
Gets or sets the size of the protected data in bytes. Implements the IRandomAccessStream.Size property.

Remarks

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

Data written to streams created using this class must be 16-byte aligned.

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