public class NetAddr extends Object
InetSocketAddress
does.Constructor and Description |
---|
NetAddr(InetAddress inetAddress,
int portNumber)
Construct a new NetAddr given an IP address and a port number.
|
NetAddr(String addressStr)
Construct a NetAddr from a string in the form:
hostName:portNumber or hostName.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other)
Test if another object is a NetAddr denoting the same address as this.
|
int |
getPort()
Get the port number.
|
int |
hashCode()
Get a hash code for this address.
|
InetAddress |
inetAddress()
Get the IP address.
|
String |
toString()
Produce a printable representation of this.
|
public NetAddr(String addressStr) throws UnknownHostException
addressStr
- The network address string, as described above.UnknownHostException
- if the host name can't be resolved.public NetAddr(InetAddress inetAddress, int portNumber)
inetAddress
- An IP address, where null => all local IP addresses.portNumber
- A port at that IP address.public boolean equals(Object other)
public InetAddress inetAddress()
public int getPort()
public int hashCode()
Copyright © 2017. All rights reserved.