public final class ChmodFilePermissions extends Object
PosixFilePermission
s to and from representations used by the
chmod
command and system call.Modifier and Type | Method and Description |
---|---|
static int |
toBits(Set<PosixFilePermission> permissions)
Converts the specified
PosixFilePermission set into a bit field
representation. |
static String |
toMode(PermissionChange change,
Set<PosixFilePermission> permissions)
Converts the specified
PosixFilePermission set and change type
into a chmod mode string. |
static Set<PosixFilePermission> |
toPermissions(int bits)
Converts the specified bit field representation into a
PosixFilePermission set. |
public static Set<PosixFilePermission> toPermissions(int bits)
PosixFilePermission
set. Unknown bits are ignored.bits
- the bit field representation of the permissions. Octal
notation is traditionally used when specifying the bit field
directly.public static int toBits(Set<PosixFilePermission> permissions)
PosixFilePermission
set into a bit field
representation.permissions
- the set of permissionspublic static String toMode(PermissionChange change, Set<PosixFilePermission> permissions)
PosixFilePermission
set and change type
into a chmod
mode string.change
- the type of changepermissions
- the permissions to changeIllegalArgumentException
- if permissions
is empty and
change
is not PermissionChange.SET