public class UnixPermissions
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static UnixPermissions |
DefaultDirectoryPermissions
The default directory permissions
|
static UnixPermissions |
DefaultFilePermissions
The default file permissions
|
Constructor and Description |
---|
UnixPermissions(boolean ownerR,
boolean ownerW,
boolean ownerX,
boolean groupR,
boolean groupW,
boolean groupX,
boolean othersR,
boolean othersW,
boolean othersX,
boolean suid,
boolean sgid,
boolean sticky)
Creates a new UnixPermissions object
|
UnixPermissions(boolean ownerR,
boolean ownerW,
boolean ownerX,
boolean groupR,
boolean groupW,
boolean groupX,
boolean othersR,
boolean othersW,
boolean othersX,
boolean suid,
boolean sgid,
boolean sticky,
int uid,
int gid)
Creates a new UnixPermissions object
|
UnixPermissions(int permissions)
Creates a new UnixPermissions object
|
UnixPermissions(int permissions,
int uid,
int gid)
Creates a new UnixPermissions object
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
int |
getGid()
Sets the owner group id
|
int |
getPermissions()
Returns the permissions as a number
|
int |
getUid()
Returns the owner user id
|
int |
hashCode() |
boolean |
isGroupExecute()
Returns true if the group may execute
|
boolean |
isGroupRead()
Returns true if the group may read
|
boolean |
isGroupWrite()
Returns true if the group may write
|
boolean |
isOthersExecute()
Returns true if the others may execute
|
boolean |
isOthersRead()
Returns true if the others may read
|
boolean |
isOthersWrite()
Returns true if the others may write
|
boolean |
isOwnerExecute()
Returns true if the owner may execute
|
boolean |
isOwnerRead()
Returns true if the owner may read
|
boolean |
isOwnerWrite()
Returns true if the owner may write
|
boolean |
isSgid()
Returns the sgid bit.
|
boolean |
isSticky()
Returns the sticky bit
|
boolean |
isSuid()
Returns the suid bit.
|
void |
setGid(int gid)
Returns the owner group id
|
void |
setGroupExecute(boolean groupExecute)
Sets the group execute permission
|
void |
setGroupRead(boolean groupRead)
Sets the group read permission
|
void |
setGroupWrite(boolean groupWrite)
Sets the group write permission
|
void |
setOthersExecute(boolean othersExecute)
Sets the others execute permission
|
void |
setOthersRead(boolean othersRead)
Sets the others read permission
|
void |
setOthersWrite(boolean othersWrite)
Sets the others write permission
|
void |
setOwnerExecute(boolean ownerExecute)
Sets the owner execute permission
|
void |
setOwnerRead(boolean ownerRead)
Sets the owner read permission
|
void |
setOwnerWrite(boolean ownerWrite)
Sets the owner write permission
|
void |
setPermissions(int permissions)
Sets the permissions (but not the user id or group id).
|
void |
setSgid(boolean sgid)
Sets the sgid bit.
|
void |
setSticky(boolean sticky)
Sets the sticky bit
|
void |
setSuid(boolean suid)
Sets the suid bit.
|
void |
setUid(int uid)
Sets the owner user id
|
java.lang.String |
toString() |
public static final UnixPermissions DefaultDirectoryPermissions
public static final UnixPermissions DefaultFilePermissions
public UnixPermissions(int permissions)
permissions
- the permissionspublic UnixPermissions(int permissions, int uid, int gid)
permissions
- the permissionsuid
- the owner user idgid
- the owner group idpublic UnixPermissions(boolean ownerR, boolean ownerW, boolean ownerX, boolean groupR, boolean groupW, boolean groupX, boolean othersR, boolean othersW, boolean othersX, boolean suid, boolean sgid, boolean sticky)
ownerR
- whether the owner may readownerW
- whether the owner may writeownerX
- whether the owner may execute a file/read a directorygroupR
- whether the group may readgroupW
- whether the group may writegroupX
- whether the group may execute a file/read a directoryothersR
- whether others may readothersW
- whether others may writeothersX
- whether others may execute a file/read a directorysuid
- the SUID bitsgid
- the SGID bitsticky
- the sticky bitpublic UnixPermissions(boolean ownerR, boolean ownerW, boolean ownerX, boolean groupR, boolean groupW, boolean groupX, boolean othersR, boolean othersW, boolean othersX, boolean suid, boolean sgid, boolean sticky, int uid, int gid)
ownerR
- whether the owner may readownerW
- whether the owner may writeownerX
- whether the owner may execute a file/read a directorygroupR
- whether the group may readgroupW
- whether the group may writegroupX
- whether the group may execute a file/read a directoryothersR
- whether others may readothersW
- whether others may writeothersX
- whether others may execute a file/read a directorysuid
- the SUID bitsgid
- the SGID bitsticky
- the sticky bituid
- the owner user idgid
- the owner group idpublic int getUid()
public void setUid(int uid)
uid
- the uid to setpublic int getGid()
public void setGid(int gid)
gid
- the gid to setpublic boolean isOwnerRead()
public void setOwnerRead(boolean ownerRead)
ownerRead
- whether the owner may readpublic boolean isOwnerWrite()
public void setOwnerWrite(boolean ownerWrite)
ownerWrite
- whether the owner may readpublic boolean isOwnerExecute()
public void setOwnerExecute(boolean ownerExecute)
ownerExecute
- whether the owner may executepublic boolean isGroupRead()
public void setGroupRead(boolean groupRead)
groupRead
- whether the group may readpublic boolean isGroupWrite()
public void setGroupWrite(boolean groupWrite)
groupWrite
- whether the group may readpublic boolean isGroupExecute()
public void setGroupExecute(boolean groupExecute)
groupExecute
- whether the group may executepublic boolean isOthersRead()
public void setOthersRead(boolean othersRead)
othersRead
- whether the others may readpublic boolean isOthersWrite()
public void setOthersWrite(boolean othersWrite)
othersWrite
- whether the others may readpublic boolean isOthersExecute()
public void setOthersExecute(boolean othersExecute)
othersExecute
- whether the others may executepublic boolean isSuid()
https://en.wikipedia.org/wiki/Setuid
public void setSuid(boolean suid)
suid
- the suid bithttps://en.wikipedia.org/wiki/Setuid
public boolean isSgid()
https://en.wikipedia.org/wiki/Setuid
public void setSgid(boolean sgid)
suid
- the sgid bithttps://en.wikipedia.org/wiki/Setuid
public boolean isSticky()
https://en.wikipedia.org/wiki/Sticky_bit
public void setSticky(boolean sticky)
sticky
- the sticky bithttps://en.wikipedia.org/wiki/Sticky_bit
public java.lang.String toString()
toString
in class java.lang.Object
public void setPermissions(int permissions)
permissions
- the permissions in numeric notationhttps://en.wikipedia.org/wiki/File_system_permissions#Numeric_notation
public int getPermissions()
https://en.wikipedia.org/wiki/File_system_permissions#Numeric_notation
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object