|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.neeve.util.UtlNet
public final class UtlNet
Utility class containing methods to manipulate network addresses.
This class MAY be used by end users, however it is not supported.
Nested Class Summary | |
---|---|
static interface |
UtlNet.DebugTracer
|
Constructor Summary | |
---|---|
UtlNet()
|
Method Summary | |
---|---|
static String |
formatNetworkInterfaceDescriptor(NetworkInterface nif)
Returns a string describing a network interface (name + all bound addresses) |
static NetworkInterface |
getFirstActiveNetworkInterface(boolean multicastRequired)
Find an active, non-virtual, non-loopback network device that might be appropriate as a primary device for general network communication and/or discovery. |
static NetworkInterface |
getFirstActiveNetworkInterface(UtlNet.DebugTracer tracer,
boolean multicastRequired)
Find an active, non-virtual, non-loopback network device that might be appropriate as a primary device for general network communication and/or discovery. |
static InetAddress |
getFirstInetAddress(NetworkInterface networkInterface)
Given a NetworkInterface , returns the first InetAddress associated with the
interface (prioritizing IPv4 over IPv6). |
static String |
inetAddrToName(String addr)
Get a host name corresponding to a inet network address. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public UtlNet()
Method Detail |
---|
public static final String inetAddrToName(String addr)
addr
- The textual representation of the inet network address.
IllegalArgumentException
- Thrown in case the user has either
supplied an inet address in the incorrect format or has provided
a host name that cannot be resolved to an IP address.
Thjis method resolves a textual representation of an inet address to its host name. In case a host name is provided in the addr parameter, this method will attempt to resolve the name to an IP address and then resolve it back to the host name.
public static final NetworkInterface getFirstActiveNetworkInterface(boolean multicastRequired) throws SocketException
multicastRequired
- indicates whether the returned network interface must support multicast
SocketException
- if there is an error getting the list of candidate network devicespublic static final NetworkInterface getFirstActiveNetworkInterface(UtlNet.DebugTracer tracer, boolean multicastRequired) throws SocketException
multicastRequired
- indicates whether the returned network interface must support multicasttracer
- the tracer to use for logging, may be null if no logging is required
SocketException
- if there is an error getting the list of candidate network devicespublic static final InetAddress getFirstInetAddress(NetworkInterface networkInterface)
NetworkInterface
, returns the first InetAddress
associated with the
interface (prioritizing IPv4 over IPv6).
networkInterface
- The network interface to inspect
public static final String formatNetworkInterfaceDescriptor(NetworkInterface nif)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |