public final class EndPoint extends Object implements Comparable<EndPoint>
java.net.InetSocketAddress
.Constructor and Description |
---|
EndPoint(InetAddress address,
int port)
Constructor.
|
EndPoint(String host,
int port)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static EndPoint |
clientEndPoint(Socket socket)
Return an
EndPoint describing the remote (client)
side of the given socket. |
int |
compareTo(EndPoint otherEndPoint)
Implement
Comparable so that we can order pairs of
EndPoint's consistently. |
boolean |
equals(Object other)
Value based equality.
|
String |
getHost()
Accessor.
|
int |
getPort()
Accessor.
|
int |
hashCode()
Implement
Object.hashCode() . |
static EndPoint |
serverEndPoint(ServerSocket socket)
Return an
EndPoint describing the local (server)
side of the given server socket. |
String |
toString()
String representation.
|
public EndPoint(String host, int port)
host
- Host name or IP address.port
- Port.public EndPoint(InetAddress address, int port)
In a perfect world, EndPoint would use
InetAddress
in its internal representation.
address
- Address.port
- Portpublic String getHost()
public int getPort()
int
valuepublic boolean equals(Object other)
public int hashCode()
Object.hashCode()
.public String toString()
public int compareTo(EndPoint otherEndPoint)
Comparable
so that we can order pairs of
EndPoint's consistently.compareTo
in interface Comparable<EndPoint>
otherEndPoint
- Object to be compared.public static EndPoint clientEndPoint(Socket socket)
EndPoint
describing the remote (client)
side of the given socket.socket
- The socket.public static EndPoint serverEndPoint(ServerSocket socket)
EndPoint
describing the local (server)
side of the given server socket.socket
- The server socket.Copyright © 2000-2014. All Rights Reserved.