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

Class java.net.InetAddress

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

public final class InetAddress
extends Object
A class that represents internet addresses.
Version:
1.17, 10/17/95
Author:
Jonathan Payne, Arthur van Hoff, Chris Warth

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, return 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 above hash table.
 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 above hash table. 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]. An array of bytes is returned so we are prepared for 64-bit IP addresses.
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 with
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 a all addresses for 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, return an array of all the corresponding InetAddresses.

 o getLocalHost

  public static InetAddress getLocalHost() throws UnknownHostException
Returns the local host.


All Packages    This Package    Previous    Next