IInputStream IInputStream IInputStream IInputStream IInputStream Interface


Represents a sequential stream of bytes to be read.

public : interface IInputStream : IClosable
struct winrt::Windows::Storage::Streams::IInputStream : IClosable
public interface IInputStream : IDisposable
Public Interface IInputStream Implements IDisposable
// You can't instantiate an interface directly in JavaScript. You can use objects that implement the interface, however.
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)


Close Close Close Close Close

Releases system resources that are exposed by a Windows Runtime object.

.NET This interface appears as System.IDisposable.

C++/CX This interface appears as Platform::IDisposable.

(Inherited from IClosable)

ReadAsync(IBuffer, UInt32, InputStreamOptions) ReadAsync(IBuffer, UInt32, InputStreamOptions) ReadAsync(IBuffer, UInt32, InputStreamOptions) ReadAsync(IBuffer, UInt32, InputStreamOptions) ReadAsync(IBuffer, UInt32, InputStreamOptions)

Reads data from the stream asynchronously.

public : IAsyncOperationWithProgress<IBuffer, unsigned int> ReadAsync(IBuffer buffer, unsigned int count, InputStreamOptions options)
IAsyncOperationWithProgress<IBuffer, uint32_t> ReadAsync(IBuffer buffer, uint32_t count, InputStreamOptions options) const;
public IAsyncOperationWithProgress<IBuffer, uint> ReadAsync(IBuffer buffer, UInt32 count, InputStreamOptions options)
Public Function ReadAsync(buffer As IBuffer, count As UInt32, options As InputStreamOptions) As IAsyncOperationWithProgress( Of IBuffer )( Of uint )
Windows.Storage.Streams.IInputStream.readAsync(buffer, count, options).done( /* Your success and error handlers */ );
IBuffer IBuffer IBuffer

A buffer that may be used to return the bytes that are read. The return value contains the buffer that holds the results.

UInt32 UInt32 UInt32

The number of bytes to read that is less than or equal to the Capacity value.

InputStreamOptions InputStreamOptions InputStreamOptions

Specifies the type of the asynchronous read operation.



Always read data from the buffer returned in the IAsyncOperationWithProgress(IBuffer, UInt32). Don't assume that the input buffer contains the data. Depending on the implementation, the data that's read might be placed into the input buffer, or it might be returned in a different buffer. For the input buffer, you don't have to implement the IBuffer interface. Instead, you can create an instance of the Buffer class.

Also consider reading a buffer into an IInputStream by using the ReadBuffer method of the DataReader class.