Crossfire JXClient, Trunk
Classes | Static Public Member Functions | Static Package Functions | List of all members
Chmod Class Reference
Collaboration diagram for Chmod:
Collaboration graph

Classes

interface  Changer
 
class  TreeVisitor
 

Static Public Member Functions

static Changer compile (String exprs)
 
static void main (String[] args) throws IOException
 

Static Package Functions

static void chmod (Path file, Changer changer)
 
static void usage ()
 

Detailed Description

Sample code that changes the permissions of files in a similar manner to the chmod(1) program.

Definition at line 53 of file Chmod.java.

Member Function Documentation

◆ chmod()

static void Chmod.chmod ( Path  file,
Changer  changer 
)
staticpackage

Changes the permissions of the file using the given Changer.

Definition at line 276 of file Chmod.java.

References Chmod.Changer.change(), and file.

Referenced by Chmod.TreeVisitor.preVisitDirectory(), and Chmod.TreeVisitor.visitFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ compile()

static Changer Chmod.compile ( String  exprs)
static

Compiles a list of one or more symbolic mode expressions that may be used to change a set of file permissions. This method is intended for use where file permissions are required to be changed in a manner similar to the UNIX chmod program.

The

exprs

parameter is a comma separated list of expressions where each takes the form:

who operator [permissions]

where who is one or more of the characters

'u'

,

'g'

,

'o'

, or

'a'

meaning the owner (user), group, others, or all (owner, group, and others) respectively.

operator is the character

'+'

,

'-'

, or

'='

signifying how permissions are to be changed.

'+'

means the permissions are added,

'-'

means the permissions are removed, and

'='

means the permissions are assigned absolutely.

permissions is a sequence of zero or more of the following:

'r'

for read permission,

'w'

for write permission, and

'x'

for execute permission. If permissions is omitted when assigned absolutely, then the permissions are cleared for the owner, group, or others as identified by who. When omitted when adding or removing then the expression is ignored.

The following examples demonstrate possible values for the

exprs

parameter:

u=rw
Sets the owner permissions to be read and write.
ug+w
Sets the owner write and group write permissions.
u+w,o-rwx
Sets the owner write, and removes the others read, others write and others execute permissions.
o=
Sets the others permission to none (others read, others write and others execute permissions are removed if set)
Parameters
exprsList of one or more symbolic mode expressions
Returns
A
Changer
that may be used to changer a set of file permissions
Exceptions
IllegalArgumentExceptionIf the value of the
exprs
parameter is invalid

Definition at line 115 of file Chmod.java.

Referenced by main().

Here is the caller graph for this function:

◆ main()

static void Chmod.main ( String[]  args) throws IOException
static

Definition at line 326 of file Chmod.java.

References compile(), file, and usage().

Here is the call graph for this function:

◆ usage()

static void Chmod.usage ( )
staticpackage

Definition at line 321 of file Chmod.java.

Referenced by main().

Here is the caller graph for this function:

The documentation for this class was generated from the following file: