| java.lang.Object | |
| ↳ | java.net.InetAddress |
Known Direct Subclasses
|
The Internet Protocol (IP) address class. This class encapsulates an IP address and provides name and reverse name resolution functions. The address is stored in network order, but as a signed (rather than unsigned) integer.
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Compares this
InetAddress against the specified object. | |||||||||||
Returns the IP address of this
InetAddress as an array. | |||||||||||
Answer the IP addresses of a named host.
| |||||||||||
Returns the InetAddress corresponding to the array of bytes, and the
given hostname.
| |||||||||||
Returns the InetAddress corresponding to the array of bytes.
| |||||||||||
Returns the address of a host, given a host string name.
| |||||||||||
Returns canonical name for the host associated with the internet address
| |||||||||||
Answer the dotted string IP address representing this address.
| |||||||||||
Answer the host name.
| |||||||||||
Answer the local host, if allowed by the security policy.
| |||||||||||
Answer a hashcode for this IP address.
| |||||||||||
Method isAnyLocalAddress.
| |||||||||||
Returns true if the address is a link local address.
| |||||||||||
Answer true if the address is a loop back address.
| |||||||||||
Returns true if the address is a global multicast address.
| |||||||||||
Returns true if the address is a link local multicast address.
| |||||||||||
Returns true if the address is a node local multicast address.
| |||||||||||
Returns true if the address is a organization local multicast address.
| |||||||||||
Returns true if the address is a site local multicast address.
| |||||||||||
Answer true if the InetAddress is an IP multicast address.
| |||||||||||
Tries to see if the InetAddress is reachable.
| |||||||||||
Tries to see if the InetAddress is reachable.
| |||||||||||
Returns true if the address is a site local address.
| |||||||||||
Returns a string containing a concise, human-readable description of the
address.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
| |||||||||||
Compares this InetAddress against the specified object.
| obj | the object to be tested for equality |
|---|
Returns the IP address of this InetAddress as an array.
The elements are in network order (the highest order address byte is in
the zero-th element).
Answer the IP addresses of a named host. The host name may either be a machine name or a dotted string IP address. If the host name is empty or null, an UnknownHostException is thrown. If the host name is a dotted IP string, an array with the corresponding single InetAddress is returned.
| host | the hostName to be resolved to an address |
|---|
| UnknownHostException | if the address lookup fails |
|---|
Returns the InetAddress corresponding to the array of bytes, and the
given hostname. In the case of an IPv4 address there must be exactly 4
bytes and for IPv6 exactly 16 bytes. If not, an UnknownHostException is
thrown.
The host name and IP address are not validated.
The hostname either be a machine alias or a valid IPv6 or IPv4 address
format.
The high order byte is ipAddress[0].
| hostName | string representation of hostname or ip address |
|---|---|
| ipAddress | either a 4 (IPv4) or 16 (IPv6) byte array |
| UnknownHostException |
|---|
Returns the InetAddress corresponding to the array of bytes. In the case
of an IPv4 address there must be exactly 4 bytes and for IPv6 exactly 16
bytes. If not, an UnknownHostException is thrown.
The IP address is not validated by a name service.
The high order byte is ipAddress[0].
| ipAddress | either a 4 (IPv4) or 16 (IPv6) byte array |
|---|
| UnknownHostException |
|---|
Returns the address of a host, given a host string name. The host string may be either a machine name or a dotted string IP address. If the latter, the hostName field will be determined upon demand.
| host | the hostName to be resolved to an address |
|---|
| UnknownHostException | if the address lookup fails |
|---|
Returns canonical name for the host associated with the internet address
Answer the dotted string IP address representing this address.
Answer the host name.
Answer the local host, if allowed by the security policy. Otherwise, answer the loopback address which allows this machine to be contacted.
| UnknownHostException | if the address lookup fails |
|---|
Answer a hashcode for this IP address.
Method isAnyLocalAddress.
Returns true if the address is a link local address. Valid IPv6 link local addresses are FE80::0 through to FEBF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF There are no valid IPv4 link local addresses.
Answer true if the address is a loop back address. Valid IPv4 loopback addresses are 127.d.d.d Valid IPv6 loopback address is ::1
Returns true if the address is a global multicast address. Valid IPv6 link global multicast addresses are FFxE:/112 where x is a set of flags, and the additional 112 bits make up the global multicast address space Valid IPv4 global multicast addresses are between: 224.0.1.0 to 238.255.255.255
Returns true if the address is a link local multicast address. Valid IPv6 link local multicast addresses are FFx2:/112 where x is a set of flags, and the additional 112 bits make up the node local multicast address space Valid IPv4 link-local addresses are between: 224.0.0.0 to 224.0.0.255
Returns true if the address is a node local multicast address. Valid IPv6 node local multicast addresses are FFx1:/112 where x is a set of flags, and the additional 112 bits make up the node local multicast address space There are no valid IPv4 node local multicast addresses.
Returns true if the address is a organization local multicast address. Valid IPv6 organization local multicast addresses are FFx8:/112 where x is a set of flags, and the additional 112 bits make up the node local multicast address space Valid IPv4 organization-local addresses are between: 239.192.0.0 to 239.251.255.255
Returns true if the address is a site local multicast address. Valid IPv6 site local multicast addresses are FFx5:/112 where x is a set of flags, and the additional 112 bits make up the node local multicast address space Valid IPv4 site-local addresses are between: 239.252.0.0 to 239.255.255.255
Answer true if the InetAddress is an IP multicast address.
Tries to see if the InetAddress is reachable. This method first tries to use ICMP(ICMP ECHO REQUEST). When first step fails, the TCP connection on port 7 (Echo) shall be lauched.
| timeout | timeout in milliseconds |
|---|
| IOException | if I/O operation meets error |
|---|---|
| IllegalArgumentException | if timeout is less than zero |
Tries to see if the InetAddress is reachable. This method first tries to use ICMP(ICMP ECHO REQUEST). When first step fails, the TCP connection on port 7 (Echo) shall be lauched.
| netif | the network interface through which to connect |
|---|---|
| ttl | max hops to live |
| timeout | timeout in milliseconds |
| IOException | if I/O operation meets error |
|---|---|
| IllegalArgumentException | if ttl or timeout is less than zero |
Returns true if the address is a site local address. Valid IPv6 link local addresses are FEC0::0 through to FEFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF There are no valid IPv4 site local addresses.
Returns a string containing a concise, human-readable description of the address.