com.metamatrix.common.util
Class NetUtils

java.lang.Object
  extended by com.metamatrix.common.util.NetUtils

public class NetUtils
extends java.lang.Object


Constructor Summary
NetUtils()
           
 
Method Summary
 java.net.InetAddress getInetAddress()
           
static NetUtils getInstance()
           
 boolean isPortAvailable(java.lang.String host, int port)
          Call to determine if a port is available to be opened.
static java.net.InetAddress resolveHostByName(java.lang.String hostName)
          Resolves the given host name into InetAddress; if host name can not be resolved then it will throw UnknownHostException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetUtils

public NetUtils()
Method Detail

getInstance

public static NetUtils getInstance()

getInetAddress

public java.net.InetAddress getInetAddress()
                                    throws java.net.UnknownHostException
Throws:
java.net.UnknownHostException

resolveHostByName

public static java.net.InetAddress resolveHostByName(java.lang.String hostName)
                                              throws java.net.UnknownHostException
Resolves the given host name into InetAddress; if host name can not be resolved then it will throw UnknownHostException

Parameters:
hostName -
Returns:
Throws:
java.net.UnknownHostException

isPortAvailable

public boolean isPortAvailable(java.lang.String host,
                               int port)
                        throws java.net.UnknownHostException
Call to determine if a port is available to be opened. This is used to determine if a port is already opened by some other process. If the port is available, then it's not in use.

Parameters:
host -
port -
Returns:
true if the port is not opened.
Throws:
java.net.UnknownHostException
Since:
4.3


Copyright © 2009. All Rights Reserved.