|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--java.net.InetAddress
This class represents an Internet Protocol version 6 (IPv6) address.
Applications should use the methods getLocalHost,
getByName, or getAllByName to
create a new InetAddress instance.
getAllByName(java.lang.String),
getByName(java.lang.String),
getLocalHost(), Serialized Form| Method Summary | |
boolean |
compare(byte[] tab1,
byte[] tab2)
|
boolean |
equals(java.lang.Object obj)
Compares this object against the specified object. |
byte[] |
getAddress()
Returns the raw IP address of this InetAddress
object. |
static InetAddress[] |
getAllByName(java.lang.String host)
Determines all the IP addresses of a host, given the host's name. |
static InetAddress |
getByName(java.lang.String host)
Determines the IP address of a host, given the host's name. |
java.lang.String |
getHostAddress()
Returns the IP address string. |
java.lang.String |
getHostName()
Returns the hostname for this address. |
static InetAddress |
getLocalHost()
Returns the local host. |
int |
hashCode()
Returns a hashcode for this IP address. |
boolean |
isMappedAddress()
Utility routine to check if the InetAddress is an IPv4-mapped one. |
boolean |
isMulticastAddress()
Utility routine to check if the InetAddress is a IP multicast address (pure IPv6 or IPv4-mapped). |
java.lang.String |
toString()
Converts this IP address to a String. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Method Detail |
public boolean isMulticastAddress()
public boolean isMappedAddress()
public java.lang.String getHostName()
If there is a security manager, its
checkConnect method is first called
with the hostname and -1
as its arguments to see if the operation is allowed.
java.lang.SecurityException - if a security manager exists and its
checkConnect method doesn't allow the operation .SecurityManager.checkConnect(java.lang.String, int)
public boolean compare(byte[] tab1,
byte[] tab2)
public byte[] getAddress()
InetAddress
object. The result is in network byte order: the highest order
byte of the address is in getAddress()[0].public java.lang.String getHostAddress()
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
true if and only if the argument is
not null and it represents the same IP address as
this object.
Two instances of InetAddress represent the same IP
address if the length of the byte arrays returned by
getAddress is the same for both, and each of the
array components is the same for the byte arrays.
equals in class java.lang.Objectobj - the object to compare against.true if the objects are the same;
false otherwise.getAddress()public java.lang.String toString()
String.toString in class java.lang.Object
public static InetAddress getByName(java.lang.String host)
throws java.net.UnknownHostException
java.sun.com", or a string representing its IP
address, such as "16ea::14d2:1345".host - the specified host, or null for the
local host.java.net.UnknownHostException - if no IP address for the
host could be found.
public static InetAddress[] getAllByName(java.lang.String host)
throws java.net.UnknownHostException
java.sun.com", or a string representing
its IP address, such as "16ea::14d2:1345".
If there is a security manager and host is not
null and host.length() is not equal to zero, the
security manager's
checkConnect method is called
with the hostname and -1
as its arguments to see if the operation is allowed.
host - the name of the host.java.net.UnknownHostException - if no IP address for the
host could be found.java.lang.SecurityException - if a security manager exists and its
checkConnect method doesn't allow the operation.SecurityManager.checkConnect(java.lang.String, int)
public static InetAddress getLocalHost()
throws java.net.UnknownHostException
If there is a security manager, its
checkConnect method is called
with the local host name and -1
as its arguments to see if the operation is allowed.
java.net.UnknownHostException - if no IP address for the
host could be found.java.lang.SecurityException - if a security manager exists and its
checkConnect method doesn't allow the operation.SecurityManager.checkConnect(java.lang.String, int)
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||