Java FilePermission class contains the permission related to a directory or file. All the permissions are related with path. The path can be of two types:
public final class FilePermission extends Permission implements Serializable
Creates a new byte array output stream with the initial capacity of 32 bytes, though its size increases if necessary.
Creates a new byte array output stream, with a buffer capacity of the specified size, in bytes.
It is used to return the hash code value of an object.
It is used to return the "canonical string representation" of an action.
It is used to check the two FilePermission objects for equality.
It is used to check the FilePermission object for the specified permission.
It is used to return the new PermissonCollection object for storing the FilePermission object.
Let's see the simple example in which permission of a directory path is granted with read permission and a file of this directory is granted for write permission.
A11 Acharya Niketan
Mayur Vihar 1
Near MayurVihar Metro Station