java.io
Class FilePermission

java.lang.Object
  extended by java.security.Permission
      extended by java.io.FilePermission
All Implemented Interfaces:
Serializable, Guard

public final class FilePermission
extends Permission
implements Serializable

See Also:
Serialized Form

Constructor Summary
FilePermission(String pathExpression, String actionsString)
          Create a new FilePermission.
 
Method Summary
 boolean equals(Object o)
          Check two FilePermissions for semantic equality.
 String getActions()
          Get the actions this FilePermission supports.
 int hashCode()
          Get the hash code for this Object.
 boolean implies(Permission p)
          Check to see if this permission implies another.
 
Methods inherited from class java.security.Permission
checkGuard, getName, newPermissionCollection, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FilePermission

public FilePermission(String pathExpression,
                      String actionsString)
Create a new FilePermission.

Parameters:
pathExpression - an expression specifying the paths this permission represents.
actionsString - a comma-separated list of the actions this permission represents. The actions must be "read", "write", "execute" and/or "delete".
Method Detail

getActions

public String getActions()
Get the actions this FilePermission supports.

Specified by:
getActions in class Permission
Returns:
the String representing the actions this FilePermission supports.

hashCode

public int hashCode()
Get the hash code for this Object.

FilePermission's hash code is calculated as the exclusive or of the target String's hash code and the action String's hash code.

Specified by:
hashCode in class Permission
Returns:
the hash code for this Object.
See Also:
Object.equals(Object), System.identityHashCode(Object)

equals

public boolean equals(Object o)
Check two FilePermissions for semantic equality. Two FilePermissions are exactly equivalent if they have identical path expressions and have exactly the same access permissions.

Specified by:
equals in class Permission
Parameters:
o - the Object to compare to.
Returns:
whether the Objects are semantically equivalent.
See Also:
Object.hashCode()

implies

public boolean implies(Permission p)
Check to see if this permission implies another. Permission A implies permission B if these things are all true:
  1. A and B are both FilePermissions.
  2. All possible files in B are included in A (possibly more are in A).
  3. All actions B supports, A also supports.

Specified by:
implies in class Permission
Parameters:
p - the Permission to compare against.
Returns:
whether this Permission implies p