java.io

Class FilePermission

public final class FilePermission extends Permission implements Serializable

Constructor Summary
FilePermission(String pathExpression, String actionsString)
Create a new FilePermission.
Method Summary
booleanequals(Object o)
Check two FilePermissions for semantic equality.
StringgetActions()
Get the actions this FilePermission supports.
inthashCode()
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.

booleanimplies(Permission p)
Check to see if this permission implies another.

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

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.

Parameters: o the Object to compare to.

Returns: whether the Objects are semantically equivalent.

getActions

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

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.

Returns: the hash code for this Object.

UNKNOWN: Sun did not specify how to calculate the hash code; I made this up.

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.

Parameters: p the Permission to compare against.

Returns: whether this Permission implies p