dsto.dfc.net
Class Localhost

java.lang.Object
  extended by dsto.dfc.net.Localhost

public final class Localhost
extends Object

General host info utilities.

Author:
Matthew Phillips

Method Summary
static String getDomain()
          Short cut to get the local host's default domain name.
static String getName()
          Short cut to get the short version of the local host name (ie without the domain name).
static InetAddress getNetworkAddress()
          Return the "real" network address of the current host (ie a non-loopback interface).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getName

public static String getName()
                      throws IOException,
                             NoHostNameException
Short cut to get the short version of the local host name (ie without the domain name).

Returns:
The host's name.
Throws:
IOException - if an error occurs accessing network adapter info.
NoHostNameException - if no host name can be found.
See Also:
getNetworkAddress()

getDomain

public static String getDomain()
                        throws IOException,
                               NoHostNameException
Short cut to get the local host's default domain name.

Returns:
The host's domain.
Throws:
IOException - if an error occurs accessing network adapter info.
NoHostNameException - if no domain can be found.
See Also:
getNetworkAddress()

getNetworkAddress

public static InetAddress getNetworkAddress()
                                     throws IOException,
                                            NoHostNameException
Return the "real" network address of the current host (ie a non-loopback interface).

Throws:
IOException - if an error occurs accessing network adapter info.
NoHostNameException - if no non-loopback address can be found.


Copyright © 2008 Commonwealth of Australia