
The Java.io.FilePermission class represents access to a file or directory.It consists of a pathname and a set of actions valid for that pathname. Following are the important points about FilePermission −
The actions to be granted are passed to the constructor in a string containing a list of one or more comma-separated keywords. The possible keywords are "read", "write", "execute", and "delete".
Code can always read a file from the same directory it's in (or a subdirectory of that directory); it does not need explicit permission to do so.
Following is the declaration for Java.io.FilePermission class −
public final class FilePermission
extends Permission
implements Serializable
| Sr.No. | Constructor & Description |
|---|---|
| 1 | FilePermission(String path, String actions) This creates a new FilePermission object with the specified actions. |
| Sr.No. | Method & Description |
|---|---|
| 1 | boolean equals(Object obj)
This method checks two FilePermission objects for equality. |
| 2 | String getActions()
This method returns the "canonical string representation" of the actions. |
| 3 | int hashCode()
This method returns the hash code value for this object. |
| 4 | boolean implies(Permission p)
This method checks if this FilePermission object "implies" the specified permission. |
| 5 | PermissionCollection newPermissionCollection()
This method returns a new PermissionCollection object for storing FilePermission objects. |
This class inherits methods from the following classes −