public final class SocketPermission extends Permission implements Serializable
Constructor and Description |
---|
SocketPermission(String host,
String action)
Creates a new SocketPermission object with the specified actions.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Checks two SocketPermission 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 socket permission object "implies" the
specified permission.
|
getName, toString
public SocketPermission(String host, String action)
To specify the local machine, use "localhost" as the host. Also note: An empty host String ("") is equivalent to "localhost".
The actions parameter contains a comma-separated list of the actions granted for the specified host (and port(s)). Possible actions are "connect", "listen", "accept", "resolve", or any combination of those. "resolve" is automatically added when any of the other three are specified.
Examples of SocketPermission instantiation are the following:
nr = new SocketPermission("www.catalog.com", "connect"); nr = new SocketPermission("www.sun.com:80", "connect"); nr = new SocketPermission("*.sun.com", "connect"); nr = new SocketPermission("*.edu", "resolve"); nr = new SocketPermission("204.160.241.0", "connect"); nr = new SocketPermission("localhost:1024-65535", "listen"); nr = new SocketPermission("204.160.241.0:1024-65535", "connect");
host
- the hostname or IPaddress of the computer, optionally
including a colon followed by a port or port range.action
- the action string.public boolean implies(Permission p)
More specifically, this method first ensures that all of the following are true (and returns false if any of them are not):
implies
checks each of the following, in order,
and for each returns true if the stated condition is true:
implies
returns false.implies
in class Permission
p
- the permission to check against.public boolean equals(Object obj)
equals
in class Permission
obj
- the object to test for equality with this object.Object.hashCode()
,
HashMap
public int hashCode()
hashCode
in class Permission
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public String getActions()
getActions
in class Permission