Class FilePermission
java.lang.Object
net.sf.basedb.opengrid.filetransfer.FilePermission
Represents the permission code for a file on a UNIX file system.
This class define numeric constanst for READ, WRITE and EXECUTE
permissions which can be OR-ed to make up a final permission.
We also define some common presets for user, group and other users.
- Since:
- 1.0
- Author:
- nicklas
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Execute permissions = 1.private final int
static final int
No permissions = 0;private final int
static final int
Read permissions = 4.private final int
static final FilePermission
Predefined set of permission giving the owner READ+WRITE permission and no permissions to other users.static final FilePermission
Predefined set of permission giving the owner READ+WRITE permission and READ permissions to other users.static final FilePermission
Predefined set of permission giving the owner READ+WRITE permission, the group READ permission and no permissions to other users.static final FilePermission
Predefined set of permission giving the owner READ+WRITE+EXECUTE permission and no permissions to other users.static final int
Write permissions = 2. -
Constructor Summary
ConstructorDescriptionFilePermission
(int user, int group, int other) Create a new set of permissions for the owner, group and all other users. -
Method Summary
Modifier and TypeMethodDescriptionchmod()
Get the octal permission representation to set in 'chmod' command.boolean
int
Get the group permission.int
Get the permission for other users.int
Get the combined permissions.int
Get the user (owner) permission.int
hashCode()
umask()
Get the octal permission representation to set in 'umask' command.
-
Field Details
-
NONE
public static final int NONENo permissions = 0;- See Also:
-
READ
public static final int READRead permissions = 4.- See Also:
-
WRITE
public static final int WRITEWrite permissions = 2.- See Also:
-
EXECUTE
public static final int EXECUTEExecute permissions = 1.- See Also:
-
USER_RW
Predefined set of permission giving the owner READ+WRITE permission and no permissions to other users. -
USER_RWX
Predefined set of permission giving the owner READ+WRITE+EXECUTE permission and no permissions to other users. -
USER_RW_GROUP_R
Predefined set of permission giving the owner READ+WRITE permission, the group READ permission and no permissions to other users. -
USER_RW_ALL_R
Predefined set of permission giving the owner READ+WRITE permission and READ permissions to other users. -
user
private final int user -
group
private final int group -
other
private final int other
-
-
Constructor Details
-
FilePermission
public FilePermission(int user, int group, int other) Create a new set of permissions for the owner, group and all other users. The permission codes are integer values between 0 and 7. Use the other constants defined in this file.
-
-
Method Details
-
getUserPermission
public int getUserPermission()Get the user (owner) permission. -
getGroupPermission
public int getGroupPermission()Get the group permission. -
getOtherPermission
public int getOtherPermission()Get the permission for other users. -
getPermissions
public int getPermissions()Get the combined permissions. -
chmod
Get the octal permission representation to set in 'chmod' command.- Since:
- 1.1
-
umask
Get the octal permission representation to set in 'umask' command.- Since:
- 1.1
-
equals
-
hashCode
public int hashCode()
-