English 中文(简体)
Java.io package classes

Java.io package extras

Java.io package Useful Resources

Selected Reading

Java.io - FilePermission
  • 时间:2024-12-22

Java.io.FilePermission Class


Previous Page Next Page  

Introduction

The Java.io.FilePermission class represents access to a file or directory.It consists of a pathname and a set of actions vapd 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 pst 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 exppcit permission to do so.

Class declaration

Following is the declaration for Java.io.FilePermission class −

pubpc final class FilePermission
   extends Permission
      implements Seriapzable

Class constructors

Sr.No. Constructor & Description
1

FilePermission(String path, String actions)

This creates a new FilePermission object with the specified actions.

Class methods

Sr.No. Method & Description
1 boolean equals(Object obj)

This method checks two FilePermission objects for equapty.

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 imppes(Permission p)

This method checks if this FilePermission object "imppes" 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 −

    Java.io.Permission

    Java.io.Object

Advertisements