public final class FileProtocolPermission extends GCFPermission
FileProtocolPermission
consists of a
URI string indicating a pathname and a set of actions desired for that
pathname.
The URI string takes the following form:
file://{pathname}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.
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)
,
"javax.microedition.io.file.FileConnection" in FileConnection Optional Package SpecificationConstructor and Description |
---|
FileProtocolPermission(String uri,
String actions)
Creates a new
FileProtocolPermission with the specified
actions. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Checks two
FileProtocolPermission objects for equality. |
String |
getActions()
Returns the canonical string representation of the actions.
|
int |
hashCode()
Returns the hash code value for this object.
|
boolean |
implies(Permission p)
Checks if this
FileProtocolPermission object "implies"
the specified permission. |
PermissionCollection |
newPermissionCollection()
Returns a new
PermissionCollection for storing
FileProtocolPermission objects. |
getProtocol, getURI
getName, toString
public FileProtocolPermission(String uri, 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.uri
- the URI stringactions
- comma-separated list of desired actionsIllegalArgumentException
- if uri
or
actions
is malformed.NullPointerException
- if uri
or
actions
is null
.Permission.getName()
,
getActions()
public boolean implies(Permission p)
FileProtocolPermission
object "implies"
the specified permission.
More specifically, this method returns true
if:
FileProtocolPermission
,
implies
in class Permission
p
- the permission to check againstpublic boolean equals(Object obj)
FileProtocolPermission
objects for equality.equals
in class 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.Boolean.hashCode()
,
Hashtable
public int hashCode()
hashCode
in class Permission
Object.equals(java.lang.Object)
,
Hashtable
public String getActions()
"read,write"
.getActions
in class Permission
public 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.
newPermissionCollection
in class Permission
PermissionCollection
suitable for storing
FileProtocolPermission
objects.