The 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.

Class declaration

Following is the declaration for class −

public final class FilePermission
   extends Permission
      implements Serializable

Class constructors

S.N. Constructor & Description

FilePermission(String path, String actions)

This creates a new FilePermission object with the specified actions.

Class methods

S.N. 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.

Methods inherited

This class inherits methods from the following classes −