Condividi tramite


ParcelFileDescriptor.Open Method

Definition

Overloads

Open(File, ParcelFileMode)

Create a new ParcelFileDescriptor accessing a given file.

Open(File, ParcelFileMode, Handler, ParcelFileDescriptor+IOnCloseListener)

Create a new ParcelFileDescriptor accessing a given file.

Open(File, ParcelFileMode)

Create a new ParcelFileDescriptor accessing a given file.

[Android.Runtime.Register("open", "(Ljava/io/File;I)Landroid/os/ParcelFileDescriptor;", "")]
public static Android.OS.ParcelFileDescriptor? Open (Java.IO.File? file, Android.OS.ParcelFileMode mode);
[<Android.Runtime.Register("open", "(Ljava/io/File;I)Landroid/os/ParcelFileDescriptor;", "")>]
static member Open : Java.IO.File * Android.OS.ParcelFileMode -> Android.OS.ParcelFileDescriptor

Parameters

file
File

The file to be opened.

mode
ParcelFileMode

The desired access mode, must be one of #MODE_READ_ONLY, #MODE_WRITE_ONLY, or #MODE_READ_WRITE; may also be any combination of #MODE_CREATE, #MODE_TRUNCATE, #MODE_WORLD_READABLE, and #MODE_WORLD_WRITEABLE.

Returns

a new ParcelFileDescriptor pointing to the given file.

Attributes

Exceptions

if the given file does not exist or can not be opened with the requested mode.

Remarks

Create a new ParcelFileDescriptor accessing a given file.

This method should only be used for files that you have direct access to; if you'd like to work with files hosted outside your app, use an API like ContentResolver#openFile(Uri, String, CancellationSignal).

Java documentation for android.os.ParcelFileDescriptor.open(java.io.File, int).

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.

See also

Applies to

Open(File, ParcelFileMode, Handler, ParcelFileDescriptor+IOnCloseListener)

Create a new ParcelFileDescriptor accessing a given file.

[Android.Runtime.Register("open", "(Ljava/io/File;ILandroid/os/Handler;Landroid/os/ParcelFileDescriptor$OnCloseListener;)Landroid/os/ParcelFileDescriptor;", "")]
public static Android.OS.ParcelFileDescriptor? Open (Java.IO.File? file, Android.OS.ParcelFileMode mode, Android.OS.Handler? handler, Android.OS.ParcelFileDescriptor.IOnCloseListener? listener);
[<Android.Runtime.Register("open", "(Ljava/io/File;ILandroid/os/Handler;Landroid/os/ParcelFileDescriptor$OnCloseListener;)Landroid/os/ParcelFileDescriptor;", "")>]
static member Open : Java.IO.File * Android.OS.ParcelFileMode * Android.OS.Handler * Android.OS.ParcelFileDescriptor.IOnCloseListener -> Android.OS.ParcelFileDescriptor

Parameters

file
File

The file to be opened.

mode
ParcelFileMode

The desired access mode, must be one of #MODE_READ_ONLY, #MODE_WRITE_ONLY, or #MODE_READ_WRITE; may also be any combination of #MODE_CREATE, #MODE_TRUNCATE, #MODE_WORLD_READABLE, and #MODE_WORLD_WRITEABLE.

handler
Handler

to call listener from; must not be null.

listener
ParcelFileDescriptor.IOnCloseListener

to be invoked when the returned descriptor has been closed; must not be null.

Returns

a new ParcelFileDescriptor pointing to the given file.

Attributes

Exceptions

if the given file does not exist or can not be opened with the requested mode.

Remarks

Java documentation for android.os.ParcelFileDescriptor.open(java.io.File, int).

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.

See also

Applies to