|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.net.SocketAddress
java.net.InetSocketAddress
public class InetSocketAddress
InetSocketAddress instances represent socket addresses in the java.nio package. They encapsulate a InetAddress and a port number.
| Constructor Summary | |
|---|---|
InetSocketAddress(InetAddress addr,
int port)
Constructs an InetSocketAddress instance. |
|
InetSocketAddress(int port)
Constructs an InetSocketAddress instance. |
|
InetSocketAddress(String hostname,
int port)
Constructs an InetSocketAddress instance. |
|
| Method Summary | |
|---|---|
static InetSocketAddress |
createUnresolved(String hostname,
int port)
Creates an unresolved InetSocketAddress object. |
boolean |
equals(Object obj)
Test if obj is a InetSocketAddress and
has the same address and port |
InetAddress |
getAddress()
Returns the InetAddress or
null if its unresolved |
String |
getHostName()
Returns hostname |
int |
getPort()
Returns the port |
int |
hashCode()
Returns the hashcode of the InetSocketAddress |
boolean |
isUnresolved()
Checks wether the address has been resolved or not |
String |
toString()
Returns the InetSocketAddress as string |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public InetSocketAddress(InetAddress addr,
int port)
throws IllegalArgumentException
addr - Address of the socketport - Port if the socket
IllegalArgumentException - If the port number is illegel
public InetSocketAddress(int port)
throws IllegalArgumentException
port - Port if the socket
IllegalArgumentException - If the port number is illegal
public InetSocketAddress(String hostname,
int port)
hostname - The hostname for the socket addressport - The port for the socket address
IllegalArgumentException - If the port number is illegal or
the hostname argument is null| Method Detail |
|---|
public static InetSocketAddress createUnresolved(String hostname,
int port)
InetSocketAddress object.
hostname - The hostname for the socket addressport - The port for the socket address
IllegalArgumentException - If the port number is illegal or
the hostname argument is nullpublic final boolean equals(Object obj)
InetSocketAddress and
has the same address and port
equals in class Objectobj - The obj to compare this address with.
Object.hashCode()public final InetAddress getAddress()
InetAddress or
null if its unresolved
public final String getHostName()
hostname
public final int getPort()
port
public final int hashCode()
InetSocketAddress
hashCode in class ObjectObject.equals(Object),
System.identityHashCode(Object)public final boolean isUnresolved()
public String toString()
InetSocketAddress as string
toString in class ObjectObject.getClass(),
Object.hashCode(),
Class.getName(),
Integer.toHexString(int)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||