java.net
Class InetAddress

java.lang.Object
  extended by java.net.InetAddress


public class InetAddress
extends Object


Method Summary
 boolean equals(Object o)
           
 byte[] getAddress()
          Return this host's IP address
static InetAddress[] getAllByName(String host)
           
static InetAddress getByAddress(byte[] addr)
           
static InetAddress getByName(String host)
           
 String getHostAddress()
          Return IP address as a period-delimited series of decimals
 String getHostName()
           
static InetAddress getLocalHost()
           
 int hashCode()
           
 boolean isMulticastAddress()
           
static String toIpAddressString(byte[] inetAddressBytes)
          Format an array of bytes as a period-delimited series of decimals
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

isMulticastAddress

public boolean isMulticastAddress()

getHostName

public String getHostName()

getAddress

public byte[] getAddress()
Return this host's IP address

Returns:
IP address as array of bytes, null if unable to resolve

getHostAddress

public String getHostAddress()
Return IP address as a period-delimited series of decimals

Returns:
IP address as string

toIpAddressString

public static String toIpAddressString(byte[] inetAddressBytes)
Format an array of bytes as a period-delimited series of decimals

Parameters:
inetAddressBytes -
Returns:
the formatted string

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

getByName

public static InetAddress getByName(String host)
                             throws UnknownHostException
Throws:
UnknownHostException

getByAddress

public static InetAddress getByAddress(byte[] addr)
                                throws UnknownHostException
Throws:
UnknownHostException

getAllByName

public static InetAddress[] getAllByName(String host)
                                  throws UnknownHostException
Throws:
UnknownHostException

getLocalHost

public static InetAddress getLocalHost()
                                throws UnknownHostException
Throws:
UnknownHostException