Class java.net.InetAddress
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.net.InetAddress

java.lang.Object
   |
   +----java.net.InetAddress

public final class InetAddress
extends Object
A class that represents Internet addresses.

Method Index

 o equals(Object)
Compares this object against the specified object.
 o getAddress()
Returns the raw IP address in network byte order.
 o getAllByName(String)
Given a hostname, returns an array of all the corresponding InetAddresses.
 o getByName(String)
Returns a network address for the indicated host.
 o getHostName()
Gets the hostname for this address; also the key in the hashtable.
 o getLocalHost()
Returns the local host.
 o hashCode()
Returns a hashcode for this InetAddress.
 o toString()
Converts the InetAddress to a String.

Methods

 o getHostName
  public String getHostName()
Gets the hostname for this address; also the key in the hashtable. If the host is equal to null, then this address refers to any of the local machine's available network addresses.
 o getAddress
  public byte[] getAddress()
Returns the raw IP address in network byte order. The highest order byte position is in addr[0]. To be prepared for 64-bit IP addresses n array of bytes is returned.
Returns:
raw IP address in network byte order.
 o hashCode
  public int hashCode()
Returns a hashcode for this InetAddress.
Overrides:
hashCode in class Object
 o equals
  public boolean equals(Object obj)
Compares this object against the specified object.
Parameters:
obj - the object to compare against.
Returns:
true if the objects are the same; false otherwise.
Overrides:
equals in class Object
 o toString
  public String toString()
Converts the InetAddress to a String.
Overrides:
toString in class Object
 o getByName
  public static synchronized InetAddress getByName(String host) throws UnknownHostException
Returns a network address for the indicated host. A host name of null refers to default address for the local machine. A local cache is used to speed access to addresses. If all addresses for a host are needed, use the getAllByName() method.
Parameters:
host - the specified host
Throws: UnknownHostException
If the address is unknown.
 o getAllByName
  public static synchronized InetAddress[] getAllByName(String host) throws UnknownHostException
Given a hostname, returns an array of all the corresponding InetAddresses.
Throws: UnknownHostException
If the host name could not be resolved
 o getLocalHost
  public static InetAddress getLocalHost() throws UnknownHostException
Returns the local host.
Throws: UnknownHostException
If the host name could not be resolved

All Packages  Class Hierarchy  This Package  Previous  Next  Index