ContentResolver.OpenTypedAssetFileDescriptor Method

Definition

Overloads

OpenTypedAssetFileDescriptor(Uri, String, Bundle, CancellationSignal)

Open a raw file descriptor to access (potentially type transformed) data from a "content:" URI.

OpenTypedAssetFileDescriptor(Uri, String, Bundle)

Open a raw file descriptor to access (potentially type transformed) data from a "content:" URI.

OpenTypedAssetFileDescriptor(Uri, String, Bundle, CancellationSignal)

Open a raw file descriptor to access (potentially type transformed) data from a "content:" URI.

[Android.Runtime.Register("openTypedAssetFileDescriptor", "(Landroid/net/Uri;Ljava/lang/String;Landroid/os/Bundle;Landroid/os/CancellationSignal;)Landroid/content/res/AssetFileDescriptor;", "")]
public Android.Content.Res.AssetFileDescriptor? OpenTypedAssetFileDescriptor (Android.Net.Uri uri, string mimeType, Android.OS.Bundle? opts, Android.OS.CancellationSignal? cancellationSignal);
[<Android.Runtime.Register("openTypedAssetFileDescriptor", "(Landroid/net/Uri;Ljava/lang/String;Landroid/os/Bundle;Landroid/os/CancellationSignal;)Landroid/content/res/AssetFileDescriptor;", "")>]
member this.OpenTypedAssetFileDescriptor : Android.Net.Uri * string * Android.OS.Bundle * Android.OS.CancellationSignal -> Android.Content.Res.AssetFileDescriptor

Parameters

uri
Uri

The desired URI to open.

mimeType
String

The desired MIME type of the returned data. This can be a pattern such as &#47;, which will allow the content provider to select a type, though there is no way for you to determine what type it is returning.

opts
Bundle

Additional provider-dependent options.

cancellationSignal
CancellationSignal

A signal to cancel the operation in progress, or null if none. If the operation is canceled, then OperationCanceledException will be thrown.

Returns

Returns a new ParcelFileDescriptor from which you can read the data stream from the provider or null if the provider recently crashed. Note that this may be a pipe, meaning you can't seek in it. The only seek you should do is if the AssetFileDescriptor contains an offset, to move to that offset before reading. You own this descriptor and are responsible for closing it when done.

Attributes

Exceptions

Throws FileNotFoundException of no data of the desired type exists under the URI.

Remarks

Open a raw file descriptor to access (potentially type transformed) data from a "content:" URI. This interacts with the underlying ContentProvider#openTypedAssetFile method of the provider associated with the given URI, to retrieve retrieve any appropriate data stream for the data stored there.

Unlike #openAssetFileDescriptor, this function only works with "content:" URIs, because content providers are the only facility with an associated MIME type to ensure that the returned data stream is of the desired type.

All text/* streams are encoded in UTF-8.

Java documentation for android.content.ContentResolver.openTypedAssetFileDescriptor(android.net.Uri, java.lang.String, android.os.Bundle, android.os.CancellationSignal).

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

OpenTypedAssetFileDescriptor(Uri, String, Bundle)

Open a raw file descriptor to access (potentially type transformed) data from a "content:" URI.

[Android.Runtime.Register("openTypedAssetFileDescriptor", "(Landroid/net/Uri;Ljava/lang/String;Landroid/os/Bundle;)Landroid/content/res/AssetFileDescriptor;", "")]
public Android.Content.Res.AssetFileDescriptor? OpenTypedAssetFileDescriptor (Android.Net.Uri uri, string mimeType, Android.OS.Bundle? opts);
[<Android.Runtime.Register("openTypedAssetFileDescriptor", "(Landroid/net/Uri;Ljava/lang/String;Landroid/os/Bundle;)Landroid/content/res/AssetFileDescriptor;", "")>]
member this.OpenTypedAssetFileDescriptor : Android.Net.Uri * string * Android.OS.Bundle -> Android.Content.Res.AssetFileDescriptor

Parameters

uri
Uri

The desired URI to open.

mimeType
String

The desired MIME type of the returned data. This can be a pattern such as &#47;, which will allow the content provider to select a type, though there is no way for you to determine what type it is returning.

opts
Bundle

Additional provider-dependent options.

Returns

Returns a new ParcelFileDescriptor from which you can read the data stream from the provider or null if the provider recently crashed. Note that this may be a pipe, meaning you can't seek in it. The only seek you should do is if the AssetFileDescriptor contains an offset, to move to that offset before reading. You own this descriptor and are responsible for closing it when done.

Attributes

Exceptions

Throws FileNotFoundException of no data of the desired type exists under the URI.

Remarks

Open a raw file descriptor to access (potentially type transformed) data from a "content:" URI. This interacts with the underlying ContentProvider#openTypedAssetFile method of the provider associated with the given URI, to retrieve retrieve any appropriate data stream for the data stored there.

Unlike #openAssetFileDescriptor, this function only works with "content:" URIs, because content providers are the only facility with an associated MIME type to ensure that the returned data stream is of the desired type.

All text/* streams are encoded in UTF-8.

Java documentation for android.content.ContentResolver.openTypedAssetFileDescriptor(android.net.Uri, java.lang.String, android.os.Bundle).

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