Android.Content.ContentResolver.OpenFileDescriptor Method
Open a raw file descriptor to access data under a URI.

Syntax

[Android.Runtime.Register("openFileDescriptor", "(Landroid/net/Uri;Ljava/lang/String;)Landroid/os/ParcelFileDescriptor;", "")]
public Android.OS.ParcelFileDescriptor OpenFileDescriptor (Android.Net.Uri uri, string mode)

See Also

ContentResolver.OpenAssetFileDescriptor(Android.Net.Uri, System.String)

Parameters

uri
The desired URI to open.
mode
The file mode to use, as per ContentProvider.OpenFile(Android.Net.Uri, System.String).

Returns

Documentation for this section has not yet been entered.

Exceptions

TypeReason
Java.IO.FileNotFoundExceptionThrows FileNotFoundException if no file exists under the URI or the mode is invalid.

Remarks

Open a raw file descriptor to access data under a URI. This is like ContentResolver.OpenAssetFileDescriptor(Android.Net.Uri, System.String), but uses the underlying ContentProvider.OpenFile(Android.Net.Uri, System.String) ContentProvider.openFile()} method, so will not work with providers that return sub-sections of files. If at all possible, you should use ContentResolver.OpenAssetFileDescriptor(Android.Net.Uri, System.String). You will receive a FileNotFoundException exception if the provider returns a sub-section of a file.

Accepts the following URI schemes:

See ContentResolver.OpenAssetFileDescriptor(Android.Net.Uri, System.String) for more information on these schemes.

If opening with the exclusive "r" or "w" modes, the returned ParcelFileDescriptor could be a pipe or socket pair to enable streaming of data. Opening with the "rw" mode implies a file on disk that supports seeking. If possible, always use an exclusive mode to give the underlying Android.Content.ContentProvider the most flexibility.

If you are writing a file, and need to communicate an error to the provider, use Android.OS.ParcelFileDescriptor.CloseWithError(string).

[Android Documentation]

Requirements

Namespace: Android.Content
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1