Udostępnij za pośrednictwem


PosixFilePermissions.FromString(String) Method

Definition

Returns the set of permissions corresponding to a given String representation.

[Android.Runtime.Register("fromString", "(Ljava/lang/String;)Ljava/util/Set;", "", ApiSince=26)]
public static System.Collections.Generic.ICollection<Java.Nio.FileNio.Attributes.PosixFilePermission>? FromString (string? perms);
[<Android.Runtime.Register("fromString", "(Ljava/lang/String;)Ljava/util/Set;", "", ApiSince=26)>]
static member FromString : string -> System.Collections.Generic.ICollection<Java.Nio.FileNio.Attributes.PosixFilePermission>

Parameters

perms
String

string representing a set of permissions

Returns

the resulting set of permissions

Attributes

Remarks

Returns the set of permissions corresponding to a given String representation.

The perms parameter is a String representing the permissions. It has 9 characters that are interpreted as three sets of three. The first set refers to the owner's permissions; the next to the group permissions and the last to others. Within each set, the first character is 'r' to indicate permission to read, the second character is 'w' to indicate permission to write, and the third character is 'x' for execute permission. Where a permission is not set then the corresponding character is set to '-'.

<b>Usage Example:</b> Suppose we require the set of permissions that indicate the owner has read, write, and execute permissions, the group has read and execute permissions and others have none.

Set&lt;PosixFilePermission&gt; perms = PosixFilePermissions.fromString("rwxr-x---");

Java documentation for java.nio.file.attribute.PosixFilePermissions.fromString(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