public final class FileProtocolPermission extends GCFPermission
FileProtocolPermission
consists of a
URI string indicating a fully-qualified, absolute pathname and a set of
actions desired for that pathname.
The URI string takes the following general form:
file://[{host}]{abs_path} | file:{abs_path}The exact syntax is given by RFCs 1738 and 2396. In addition, a pathname that ends in "/*" indicates all the files and directories contained in that directory. A pathname that ends with "/-" indicates (recursively) all files and subdirectories contained in that directory. In addition to the syntax defined by RFC 1738, FileProtocolPermission MUST accept and normalize URIs of the form
file:{abs_path}
.
Note that {host}
equals localhost
is
the same as if the host was absent.
Note that {abs_path}
follows the syntax defined
for {fpath}
in RFC 1738.
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" and "write". The actions string is converted to lowercase before processing.
Connector.open(java.lang.String)
Constructor and Description |
---|
FileProtocolPermission(java.lang.String uri,
java.lang.String actions)
Creates a new
FileProtocolPermission with the specified
actions. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Checks two
FileProtocolPermission objects for equality. |
java.lang.String |
getActions()
Returns the canonical string representation of the actions.
|
int |
hashCode()
Returns the hash code value for this object.
|
boolean |
implies(java.security.Permission p)
Checks if this
FileProtocolPermission object "implies"
the specified permission. |
java.security.PermissionCollection |
newPermissionCollection()
Returns a new
PermissionCollection for storing
FileProtocolPermission objects. |
getProtocol, getURI
public FileProtocolPermission(java.lang.String uri, java.lang.String actions)
FileProtocolPermission
with the specified
actions. The specified URI becomes the name of the
FileProtocolPermission
.
The URI string must conform to the specification given above,
and is
normalized
to facilitate subsequent comparisons.uri
- the URI stringactions
- comma-separated list of desired actionsjava.lang.IllegalArgumentException
- if uri
or
actions
is malformed.java.lang.NullPointerException
- if uri
or
actions
is null
.Permission.getName()
,
getActions()
public boolean equals(java.lang.Object obj)
FileProtocolPermission
objects for equality.equals
in class java.security.Permission
obj
- the object we are testing for equality with this object.true
if obj
is a
FileProtocolPermission
,
and has the same URI string and actions as
this FileProtocolPermission
object.Object.hashCode()
,
HashMap
public java.lang.String getActions()
"read,write"
.getActions
in class java.security.Permission
public int hashCode()
hashCode
in class java.security.Permission
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public boolean implies(java.security.Permission p)
FileProtocolPermission
object "implies"
the specified permission.
More specifically, this method returns true
if:
FileProtocolPermission
,
implies
in class java.security.Permission
p
- the permission to check againsttrue
if the specified permission is implied by this object,
false
if not.public java.security.PermissionCollection newPermissionCollection()
PermissionCollection
for storing
FileProtocolPermission
objects.
FileProtocolPermission
objects must be stored in a
manner that allows
them to be inserted into the collection in any order, but that also
enables the PermissionCollection
implies method to be
implemented in an efficient (and consistent) manner.
If null
is returned,
then the caller of this method is free to store permissions of this
type in any PermissionCollection they choose (one that uses a Hashtable,
one that uses a Vector, etc).
newPermissionCollection
in class java.security.Permission
PermissionCollection
suitable for storing
FileProtocolPermission
objects, or
null
if one is not defined.Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. Use of this specification is subject to license terms.