public final class PosixFilePermissionSupport extends Object
PosixFilePermission
.Modifier and Type | Method and Description |
---|---|
static Set<PosixFilePermission> |
fromMask(int mask)
Returns the set of permissions corresponding to a permission bit mask.
|
static boolean |
hasPermission(int mask,
PosixFilePermission permission)
Returns whether or not a specific permission is set in a permission bit mask.
|
static int |
toMask(Set<PosixFilePermission> permissions)
Returns a permission bit mask corresponding to a set of permissions.
|
public static Set<PosixFilePermission> fromMask(int mask)
PosixFilePermission.OWNER_READ
PosixFilePermission.OWNER_WRITE
PosixFilePermission.OWNER_EXECUTE
PosixFilePermission.GROUP_READ
PosixFilePermission.GROUP_WRITE
PosixFilePermission.GROUP_EXECUTE
PosixFilePermission.OTHERS_READ
PosixFilePermission.OTHERS_WRITE
PosixFilePermission.OTHERS_EXECUTE
mask
- The bit mask representing a set of permissions.public static int toMask(Set<PosixFilePermission> permissions)
fromMask(int)
.permissions
- The set of permissions.NullPointerException
- If the given set is null
.public static boolean hasPermission(int mask, PosixFilePermission permission)
More formally, this method returns true
only if the given permission is contained in the set returned by fromMask(int)
.
mask
- The permission bit mask to check.permission
- The permission to check for.true
if the permission is set in the given permission bit mask, or false
otherwise.NullPointerException
- If the given set is null
.Copyright © 2016–2023. All rights reserved.