public class PosixPermissions
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
PosixPermissions.Type
Permission types.
|
Modifier and Type | Field and Description |
---|---|
private boolean |
isInGroup
If one user group is the group of the file.
|
private boolean |
isOwner
If the user is the owner of the file.
|
private int |
permissions
Current permissions.
|
Constructor and Description |
---|
PosixPermissions(int permissions,
boolean isOwner,
boolean isInGroup)
Creates a new PosixPermissions object.
|
Modifier and Type | Method and Description |
---|---|
private int |
computeNewPermissions(java.util.Map<PosixPermissions.Type,java.lang.Boolean> values)
Computes new permission from old ones.
|
private boolean |
get(PosixPermissions.Type type)
Tests whether the bit corresponding to the permission is set.
|
int |
getPermissions()
Gets permissions.
|
boolean |
isExecutable()
Gets whether the permissions are executable.
|
boolean |
isReadable()
Gets whether the permissions are readable.
|
boolean |
isWritable()
Gets whether the permissions are writable.
|
int |
makeExecutable(boolean executable,
boolean ownerOnly)
Creates new permissions based on these permissions.
|
java.lang.Integer |
makeReadable(boolean readable,
boolean ownerOnly)
Creates new permissions based on these permissions.
|
java.lang.Integer |
makeWritable(boolean writable,
boolean ownerOnly)
Creates new permissions based on these permissions.
|
private final int permissions
private final boolean isOwner
private final boolean isInGroup
public PosixPermissions(int permissions, boolean isOwner, boolean isInGroup)
permissions
- The permissionsisOwner
- true if the user is the owner of the fileisInGroup
- true if the user is a group owner of the fileprivate int computeNewPermissions(java.util.Map<PosixPermissions.Type,java.lang.Boolean> values)
values
- The permissions to set.private boolean get(PosixPermissions.Type type)
public int getPermissions()
public boolean isExecutable()
public boolean isReadable()
public boolean isWritable()
public int makeExecutable(boolean executable, boolean ownerOnly)
executable
- Whether the new permissions should be readable.ownerOnly
- Whether the new permissions are only for the owner.public java.lang.Integer makeReadable(boolean readable, boolean ownerOnly)
readable
- Whether the new permissions should be readable.ownerOnly
- Whether the new permissions are only for the owner.public java.lang.Integer makeWritable(boolean writable, boolean ownerOnly)
writable
- Whether the new permissions should be readable.ownerOnly
- Whether the new permissions are only for the owner.