DocumentsProvider.OpenDocument(String, String, CancellationSignal) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Open and return the requested document.
[Android.Runtime.Register("openDocument", "(Ljava/lang/String;Ljava/lang/String;Landroid/os/CancellationSignal;)Landroid/os/ParcelFileDescriptor;", "GetOpenDocument_Ljava_lang_String_Ljava_lang_String_Landroid_os_CancellationSignal_Handler")]
public abstract Android.OS.ParcelFileDescriptor? OpenDocument (string? documentId, string? mode, Android.OS.CancellationSignal? signal);
[<Android.Runtime.Register("openDocument", "(Ljava/lang/String;Ljava/lang/String;Landroid/os/CancellationSignal;)Landroid/os/ParcelFileDescriptor;", "GetOpenDocument_Ljava_lang_String_Ljava_lang_String_Landroid_os_CancellationSignal_Handler")>]
abstract member OpenDocument : string * string * Android.OS.CancellationSignal -> Android.OS.ParcelFileDescriptor
Parameters
- documentId
- String
the document to return.
- mode
- String
the mode to open with, such as 'r', 'w', or 'rw'.
- signal
- CancellationSignal
used by the caller to signal if the request should be cancelled. May be null.
Returns
- Attributes
Exceptions
Remarks
Open and return the requested document.
Your provider should return a reliable ParcelFileDescriptor
to detect when the remote caller has finished reading or writing the document.
Mode "r" should always be supported. Provider should throw UnsupportedOperationException
if the passing mode is not supported. You may return a pipe or socket pair if the mode is exclusively "r" or "w", but complex modes like "rw" imply a normal file on disk that supports seeking.
If you block while downloading content, you should periodically check CancellationSignal#isCanceled()
to abort abandoned open requests.
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.OS.ParcelFileDescriptor.Open(Java.IO.File%2c+Android.OS.ParcelFileMode%2c+Android.OS.ParcelFileMode%2c+Android.OS.ParcelFileMode)>
- CreateReliablePipe()
- CreateReliableSocketPair()
- ParseMode(String)