@PublicAPI(stability=VOLATILE, mayInstantiate=true, mayExtend=false, mayInvoke=true) public class FilePermission extends Object
Constructor and Description |
---|
FilePermission(int encodedPermission)
Creates a new file permission object with the provided encoded
representation.
|
Modifier and Type | Method and Description |
---|---|
static FilePermission |
decodeUNIXMode(String modeString)
Decodes the provided string as a UNIX mode and retrieves the
corresponding file permission.
|
boolean |
isGroupExecutable()
Indicates whether this file permission includes the group execute
permission.
|
boolean |
isGroupReadable()
Indicates whether this file permission includes the group read
permission.
|
boolean |
isGroupWritable()
Indicates whether this file permission includes the group write
permission.
|
boolean |
isOtherExecutable()
Indicates whether this file permission includes the other execute
permission.
|
boolean |
isOtherReadable()
Indicates whether this file permission includes the other read
permission.
|
boolean |
isOtherWritable()
Indicates whether this file permission includes the other write
permission.
|
boolean |
isOwnerExecutable()
Indicates whether this file permission includes the owner execute
permission.
|
boolean |
isOwnerReadable()
Indicates whether this file permission includes the owner read
permission.
|
boolean |
isOwnerWritable()
Indicates whether this file permission includes the owner write
permission.
|
static boolean |
setPermissions(File f,
FilePermission p)
Attempts to set the given permissions on the specified file.
|
static boolean |
setSafePermissions(File f,
Integer p)
Attempts to set the given permissions on the specified file.
|
String |
toString()
Retrieves a string representation of this file permission.
|
static String |
toUNIXMode(FilePermission p)
Retrieves a three-character string that is the UNIX mode for the
provided file permission.
|
public FilePermission(int encodedPermission)
encodedPermission
- The encoded representation for this
file permission.public boolean isOwnerReadable()
true
if this file permission includes the
owner read permission, or false
if not.public boolean isOwnerWritable()
true
if this file permission includes the
owner write permission, or false
if not.public boolean isOwnerExecutable()
true
if this file permission includes the
owner execute permission, or false
if not.public boolean isGroupReadable()
true
if this file permission includes the
group read permission, or false
if not.public boolean isGroupWritable()
true
if this file permission includes the
group write permission, or false
if not.public boolean isGroupExecutable()
true
if this file permission includes the
group execute permission, or false
if not.public boolean isOtherReadable()
true
if this file permission includes the
other read permission, or false
if not.public boolean isOtherWritable()
true
if this file permission includes the
other write permission, or false
if not.public boolean isOtherExecutable()
true
if this file permission includes the
other execute permission, or false
if not.public static boolean setPermissions(File f, FilePermission p) throws FileNotFoundException, DirectoryException
f
- The file to which the permissions should be applied.p
- The permissions to apply to the file.true
if the permissions (or the nearest
equivalent) were successfully applied to the specified
file, or false
if was not possible to set
the permissions on the current platform.FileNotFoundException
- If the specified file does not
exist.DirectoryException
- If a problem occurs while trying to
set the file permissions.public static boolean setSafePermissions(File f, Integer p)
f
- The file to which the permissions should be applied.p
- The permissions to apply to the file.true
if the permissions (or the nearest
equivalent) were successfully applied to the specified
file, or false
if was not possible to set
the permissions on the current platform.
The file is known to exist therefore there is no need for
exists() checks.public static String toUNIXMode(FilePermission p)
p
- The permission to retrieve as a UNIX mode string.public static FilePermission decodeUNIXMode(String modeString) throws DirectoryException
modeString
- The string representation of the UNIX mode to
decode.DirectoryException
- If the provided string is not a
valid three-digit UNIX mode.Copyright © 2010-2017 ForgeRock AS. All Rights Reserved.