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

boolean equals(Object obj)

This method checks two FilePermission objects for equality.


String getActions()

This method returns the "canonical string representation" of the actions.


int hashCode()

This method returns the hash code value for this object.


boolean implies(Permission p)

This method checks if this FilePermission object "implies" the specified permission.


PermissionCollection newPermissionCollection()

This method returns a new PermissionCollection object for storing FilePermission objects.

Methods inherited

This class inherits methods from the following classes: