Compartir a través de


ParcelFileDescriptor.ParseMode(String) Method

Definition

Converts a string representing a file mode, such as "rw", into a bitmask suitable for use with #open.

[Android.Runtime.Register("parseMode", "(Ljava/lang/String;)I", "")]
public static Android.OS.ParcelFileMode ParseMode (string? mode);
[<Android.Runtime.Register("parseMode", "(Ljava/lang/String;)I", "")>]
static member ParseMode : string -> Android.OS.ParcelFileMode

Parameters

mode
String

The string representation of the file mode. Can be "r", "w", "wt", "wa", "rw" or "rwt".

Returns

A bitmask representing the given file mode.

Attributes

Exceptions

if the given string does not match a known file mode.

Remarks

Converts a string representing a file mode, such as "rw", into a bitmask suitable for use with #open.

The argument must define at least one of the following base access modes: <ul> <li>"r" indicates the file should be opened in read-only mode, equivalent to OsConstants#O_RDONLY. <li>"w" indicates the file should be opened in write-only mode, equivalent to OsConstants#O_WRONLY. <li>"rw" indicates the file should be opened in read-write mode, equivalent to OsConstants#O_RDWR. </ul> In addition to a base access mode, the following additional modes may requested: <ul> <li>"a" indicates the file should be opened in append mode, equivalent to OsConstants#O_APPEND. Before each write, the file offset is positioned at the end of the file. <li>"t" indicates the file should be opened in truncate mode, equivalent to OsConstants#O_TRUNC. If the file already exists and is a regular file and is opened for writing, it will be truncated to length 0. </ul>

Java documentation for android.os.ParcelFileDescriptor.parseMode(java.lang.String).

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