Name
FilePermission
Synopsis
This class is
a java.security.Permission
that governs access to
the local filesystem. A FilePermission
has a name,
or target, which specifies what file or files it pertains to, and a
commaseparated list of actions that may be performed on the file or
files. The supported actions are
read,
write, delete, and execute. Read and write permission are required by
any methods that read or write a file. Delete permission is required
by File.delete( )
, and execute permission is
required by Runtime.exec( )
.
The
name
of a FilePermission
may be as simple as a file or
directory name. FilePermission
also supports the
use of certain wildcards, however, to specify a
permission that applies to more than one file. If the name of the
FilePermission
is a directory name followed by
/*
(\*
on
Windows platforms), it
specifies all files in the named directory. If the name is a
directory name followed by /-
(\-
on Windows), it specifies all files in the
directory, and, recursively, all files in all subdirectories. A
*
alone specifies all files in the current
directory, and a -
alone specifies all files in or
beneath the current directory. Finally, the special name <<ALL
FILES>> matches all files anywhere in the filesystem.
Applications
do not need to use
this class directly. Programmers writing system-level code and system
administrators configuring security policies may need to use it,
however. Be very careful when granting any type of
FilePermission
. Restricting access ...
Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.