Package org.apache.commons.vfs2.util
Class PosixPermissions
java.lang.Object
org.apache.commons.vfs2.util.PosixPermissions
- Direct Known Subclasses:
UserIsOwnerPosixPermissions
UNIX permissions.
- Since:
- 2.1
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanIf one user group is the group of the file.private final booleanIf the user is the owner of the file.private final intCurrent permissions. -
Constructor Summary
ConstructorsConstructorDescriptionPosixPermissions(int permissions, boolean isOwner, boolean isInGroup) Creates a new PosixPermissions object. -
Method Summary
Modifier and TypeMethodDescriptionprivate intComputes new permission from old ones.private booleanget(PosixPermissions.Type type) Tests whether the bit corresponding to the permission is set.intGets permissions.booleanGets whether the permissions are executable.booleanGets whether the permissions are readable.booleanGets whether the permissions are writable.intmakeExecutable(boolean executable, boolean ownerOnly) Creates new permissions based on these permissions.makeReadable(boolean readable, boolean ownerOnly) Creates new permissions based on these permissions.makeWritable(boolean writable, boolean ownerOnly) Creates new permissions based on these permissions.
-
Field Details
-
permissions
private final int permissionsCurrent permissions. -
isOwner
private final boolean isOwnerIf the user is the owner of the file. -
isInGroup
private final boolean isInGroupIf one user group is the group of the file.
-
-
Constructor Details
-
PosixPermissions
public PosixPermissions(int permissions, boolean isOwner, boolean isInGroup) Creates a new PosixPermissions object.- Parameters:
permissions- The permissionsisOwner- true if the user is the owner of the fileisInGroup- true if the user is a group owner of the file
-
-
Method Details
-
computeNewPermissions
Computes new permission from old ones.- Parameters:
values- The permissions to set.- Returns:
- The new permissions.
-
get
Tests whether the bit corresponding to the permission is set.- Returns:
- whether the bit corresponding to the permission is set.
-
getPermissions
public int getPermissions()Gets permissions.- Returns:
- permissions.
-
isExecutable
public boolean isExecutable()Gets whether the permissions are executable.- Returns:
- whether the permissions are executable.
-
isReadable
public boolean isReadable()Gets whether the permissions are readable.- Returns:
- whether the permissions are readable.
-
isWritable
public boolean isWritable()Gets whether the permissions are writable.- Returns:
- whether the permissions are writable.
-
makeExecutable
public int makeExecutable(boolean executable, boolean ownerOnly) Creates new permissions based on these permissions.- Parameters:
executable- Whether the new permissions should be readable.ownerOnly- Whether the new permissions are only for the owner.- Returns:
- the new permissions.
-
makeReadable
Creates new permissions based on these permissions.- Parameters:
readable- Whether the new permissions should be readable.ownerOnly- Whether the new permissions are only for the owner.- Returns:
- the new permissions.
-
makeWritable
Creates new permissions based on these permissions.- Parameters:
writable- Whether the new permissions should be readable.ownerOnly- Whether the new permissions are only for the owner.- Returns:
- the new permissions.
-