|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.artima.place.ServerAddress
Holds a String
host name and int
port number.
The host name must be in either quad or domain name form.
ServerAddress
is not clonable because its immutable.
Constructor Summary | |
ServerAddress(java.lang.String host,
int port)
Constructs a ServerAddress with passed
String host name and int port number. |
Method Summary | |
boolean |
equals(java.lang.Object o)
Compares the specified Object with this
ServerAddress for equality. |
java.lang.String |
getHost()
Returns the String host name that's stored in this
ServerAddress . |
int |
getPort()
Returns the int port number that's stored in this
ServerAddress . |
int |
hashCode()
Returns the hash code value for this ServerAddress . |
static boolean |
isValidHost(java.lang.String host)
Returns true if passed String is a valid
host name. |
static boolean |
isValidPort(int port)
Returns true if passed int is a valid
port number. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ServerAddress(java.lang.String host, int port)
ServerAddress
with passed
String
host name and int
port number. The
server host name should be in quad or domain name form, acceptable to
the isValidHost
method of this class.host
- a server host name in quad or domain name formport
- a server port numberNullPointerException
- if the host
reference passed to this constructor is null
java.lang.IllegalArgumentException
- if the port
passed to
this constructor is less than zero or greater than 65,535, or if
the host
is not a well-formed host name in quad or
domain name formMethod Detail |
public java.lang.String getHost()
String
host name that's stored in this
ServerAddress
.String
host name held in this
ServerAddress
public int getPort()
int
port number that's stored in this
ServerAddress
.ServerAddress
public boolean equals(java.lang.Object o)
Object
with this
ServerAddress
for equality. Two
ServerAddress
s are semantically equal if their host names
are semantically equal and their ports are equal.equals
in class java.lang.Object
o
- the object to compare to this one.true
if this object is semantically equal to the
passed object.public int hashCode()
ServerAddress
.hashCode
in class java.lang.Object
public static boolean isValidPort(int port)
true
if passed int
is a valid
port number. To be valid, the passed int
must be
greater than or equal to zero and less than or equal to 65535.port
- a server port numbertrue
if the port number is validpublic static boolean isValidHost(java.lang.String host)
true
if passed String
is a valid
host name. To be valid, the passed int
must be
either a valid IP address in quad form or a well-formed domain name.
This method does not verify that any particular IP address or domain
name exists or is reachable, just that the String
is
well-formed.host
- a server host name in quad or domain name formtrue
if the host name is valid
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |