StreamedFileDataRequest StreamedFileDataRequest StreamedFileDataRequest StreamedFileDataRequest Class


Represents a sequential-access output stream that indicates a request for the data stream of a StorageFile that was created by calling CreateStreamedFileAsync or ReplaceWithStreamedFileAsync.

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


This object is passed to the app's StreamedFileDataRequestedHandler function when a stream that is represented by a StorageFile is accessed. Define the StreamedFileDataRequestedHandler function if you use CreateStreamedFileAsync or ReplaceWithStreamedFileAsync to get a StorageFile that represents the stream.


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

Releases system resources that are exposed by the current stream indicating that the data request is complete.

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

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()

FailAndClose(StreamedFileFailureMode) FailAndClose(StreamedFileFailureMode) FailAndClose(StreamedFileFailureMode) FailAndClose(StreamedFileFailureMode)

Indicates that the data can't be streamed and releases system resources that are exposed by the current stream indicating that the data request is complete.

public : void FailAndClose(StreamedFileFailureMode failureMode)
public void FailAndClose(StreamedFileFailureMode failureMode)
Public Function FailAndClose(failureMode As StreamedFileFailureMode) As void
StreamedFileFailureMode StreamedFileFailureMode StreamedFileFailureMode StreamedFileFailureMode

The enum value that indicates why the data stream can't be accessed.

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

Flushes the data in the current stream.

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

When this method completes, it returns true if the data was flushed successfully or false if the flush operation failed.

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

Writes data from a buffer to the current 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.StreamedFileDataRequest.writeAsync(buffer).done( /* Your success and error handlers */ );
IBuffer IBuffer IBuffer IBuffer

The buffer that contains the data to write.


When this method completes, it returns the number of bytes (type UInt32) that were written to the stream. If the app specifies a function to monitor progress, that function receives the number of bytes (type UInt32) written so far.