ContentResolver.OpenInputStream(Uri) Method

Definition

Open a stream on to the content associated with a content URI.

[Android.Runtime.Register("openInputStream", "(Landroid/net/Uri;)Ljava/io/InputStream;", "")]
public System.IO.Stream? OpenInputStream (Android.Net.Uri uri);
[<Android.Runtime.Register("openInputStream", "(Landroid/net/Uri;)Ljava/io/InputStream;", "")>]
member this.OpenInputStream : Android.Net.Uri -> System.IO.Stream

Parameters

uri
Uri

The desired URI.

Returns

InputStream or null if the provider recently crashed.

Attributes

Exceptions

if the provided URI could not be opened.

Remarks

Open a stream on to the content associated with a content URI. If there is no data associated with the URI, FileNotFoundException is thrown.

<h5>Accepts the following URI schemes:</h5> <ul> <li>content (#SCHEME_CONTENT)</li> <li>android.resource (#SCHEME_ANDROID_RESOURCE)</li> <li>file (#SCHEME_FILE)</li> </ul>

See #openAssetFileDescriptor(Uri, String) for more information on these schemes.

Java documentation for android.content.ContentResolver.openInputStream(android.net.Uri).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

See also

  • <xref:Android.Content.ContentResolver.OpenAssetFileDescriptor(Android.Net.Uri%2c+System.String)>