|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.net.InetAddress
public class InetAddress
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.
| Nested Class Summary | |
|---|---|
(package private) static class |
InetAddress.Cache
|
(package private) class |
InetAddress.CacheElement
|
| Field Summary | |
|---|---|
(package private) static InetAddress |
ANY
|
(package private) static byte[] |
any_bytes
|
(package private) int |
family
|
(package private) String |
hostName
|
(package private) byte[] |
ipaddress
|
(package private) static byte[] |
localhost_bytes
|
(package private) static InetAddress |
LOOPBACK
|
| Constructor Summary | |
|---|---|
InetAddress()
Constructs an InetAddress. |
|
InetAddress(byte[] address)
Constructs an InetAddress, representing the address and
hostName. |
|
InetAddress(byte[] address,
String hostName)
Constructs an InetAddress, representing the address and
hostName. |
|
| Method Summary | |
|---|---|
(package private) static byte[] |
addressOf(int addr)
Returns the IP address of the argument addr as an array. |
(package private) static int |
bytesToInt(byte[] bytes,
int start)
Takes the byte array and creates an integer out of four bytes starting at start as the high-order byte. |
(package private) InetAddress.CacheElement |
cacheElement()
|
(package private) static InetAddress |
createHostNameFromIPAddress(String ipAddressString)
Creates an InetAddress based on an ipAddressString. |
boolean |
equals(Object obj)
Compares this InetAddress against the specified object. |
byte[] |
getAddress()
Returns the IP address of this InetAddress as an array. |
(package private) static InetAddress[] |
getAliasesByNameImpl(String name)
Query the IP stack for aliases for the host. |
static InetAddress[] |
getAllByName(String host)
Answer the IP addresses of a named host. |
static InetAddress |
getByAddress(byte[] ipAddress)
Returns the InetAddress corresponding to the array of bytes. |
(package private) static InetAddress |
getByAddress(byte[] ipAddress,
int scope_id)
Returns the InetAddress corresponding to the array of bytes. |
static InetAddress |
getByAddress(String hostName,
byte[] ipAddress)
Returns the InetAddress corresponding to the array of bytes, and the given hostname. |
(package private) static InetAddress |
getByAddressInternal(String hostName,
byte[] ipAddress,
int scope_id)
Returns the InetAddress corresponding to the array of bytes, and the given hostname. |
static InetAddress |
getByName(String host)
Returns the address of a host, given a host string name. |
String |
getCanonicalHostName()
Returns canonical name for the host associated with the internet address |
String |
getHostAddress()
Answer the dotted string IP address representing this address. |
(package private) static InetAddress |
getHostByAddrImpl(byte[] addr)
Query the IP stack for the host address. |
(package private) static InetAddress |
getHostByNameImpl(String name,
boolean preferIPv6Address)
Query the IP stack for the host address. |
String |
getHostName()
Answer the host name. |
(package private) static String |
getHostNameImpl()
Query the IP stack for the host machine name. |
(package private) static String |
getHostNameInternal(String host)
|
static InetAddress |
getLocalHost()
Answer the local host, if allowed by the security policy. |
int |
hashCode()
Answer a hashcode for this IP address. |
(package private) static int |
inetAddr(String host)
|
(package private) static int |
inetAddrImpl(String host)
Convert a string containing an Ipv4 Internet Protocol dotted address into a binary address. |
(package private) static String |
inetNtoaImpl(int hipAddr)
Convert a binary address into a string containing an Ipv4 Internet Protocol dotted address. |
(package private) static void |
intToBytes(int value,
byte[] bytes,
int start)
Takes the integer and chops it into 4 bytes, putting it into the byte array starting with the high order byte at the index start. |
boolean |
isAnyLocalAddress()
Method isAnyLocalAddress. |
boolean |
isLinkLocalAddress()
Returns true if the address is a link local address. |
boolean |
isLoopbackAddress()
Answer true if the address is a loop back address. |
boolean |
isMCGlobal()
Returns true if the address is a global multicast address. |
boolean |
isMCLinkLocal()
Returns true if the address is a link local multicast address. |
boolean |
isMCNodeLocal()
Returns true if the address is a node local multicast address. |
boolean |
isMCOrgLocal()
Returns true if the address is a organization local multicast address. |
boolean |
isMCSiteLocal()
Returns true if the address is a site local multicast address. |
boolean |
isMulticastAddress()
Answer true if the InetAddress is an IP multicast address. |
boolean |
isReachable(int timeout)
Tries to see if the InetAddress is reachable. |
boolean |
isReachable(NetworkInterface netif,
int ttl,
int timeout)
Tries to see if the InetAddress is reachable. |
boolean |
isSiteLocalAddress()
Returns true if the address is a site local address. |
(package private) static InetAddress |
lookupHostByName(String host)
|
(package private) static boolean |
preferIPv6Addresses()
|
String |
toString()
Returns a string containing a concise, human-readable description of the address. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
static final byte[] any_bytes
static final byte[] localhost_bytes
static InetAddress ANY
static final InetAddress LOOPBACK
String hostName
int family
byte[] ipaddress
| Constructor Detail |
|---|
InetAddress()
InetAddress(byte[] address)
address and
hostName.
address - network address
InetAddress(byte[] address,
String hostName)
address and
hostName.
address - network address| Method Detail |
|---|
static byte[] addressOf(int addr)
addr as an array.
The elements are in network order (the highest order address byte is in
the zero-th element).
InetAddress.CacheElement cacheElement()
public boolean equals(Object obj)
InetAddress against the specified object.
equals in class Objectobj - the object to be tested for equality
Object.hashCode()public byte[] getAddress()
InetAddress as an array.
The elements are in network order (the highest order address byte is in
the zero-th element).
public static InetAddress[] getAllByName(String host)
throws UnknownHostException
host - the hostName to be resolved to an address
UnknownHostException - if the address lookup fails
public static InetAddress getByName(String host)
throws UnknownHostException
host - the hostName to be resolved to an address
UnknownHostException - if the address lookup failspublic String getHostAddress()
public String getHostName()
public String getCanonicalHostName()
public static InetAddress getLocalHost()
throws UnknownHostException
UnknownHostException - if the address lookup failspublic int hashCode()
hashCode in class ObjectObject.equals(java.lang.Object)public boolean isMulticastAddress()
static InetAddress lookupHostByName(String host)
throws UnknownHostException
UnknownHostException
static InetAddress[] getAliasesByNameImpl(String name)
throws UnknownHostException
name - the host name to lookup
UnknownHostException - if an error occurs during lookup
static InetAddress getHostByAddrImpl(byte[] addr)
throws UnknownHostException
addr - the host address to lookup
UnknownHostException - if an error occurs during lookup
static int inetAddr(String host)
throws UnknownHostException
UnknownHostException
static int inetAddrImpl(String host)
throws UnknownHostException
UnknownHostExceptionstatic String inetNtoaImpl(int hipAddr)
static InetAddress getHostByNameImpl(String name,
boolean preferIPv6Address)
throws UnknownHostException
name - the host name to lookuppreferIPv6Addresses - address preference if underlying platform is V4/V6
UnknownHostException - if an error occurs during lookupstatic String getHostNameImpl()
static String getHostNameInternal(String host)
throws UnknownHostException
UnknownHostExceptionpublic String toString()
toString in class Objectpublic boolean isLoopbackAddress()
public boolean isLinkLocalAddress()
public boolean isSiteLocalAddress()
public boolean isMCGlobal()
public boolean isMCNodeLocal()
public boolean isMCLinkLocal()
public boolean isMCSiteLocal()
public boolean isMCOrgLocal()
public boolean isAnyLocalAddress()
public boolean isReachable(int timeout)
throws IOException
timeout - timeout in milliseconds
IOException - if I/O operation meets error
IllegalArgumentException - if timeout is less than zero
public boolean isReachable(NetworkInterface netif,
int ttl,
int timeout)
throws IOException
netif - the network interface through which to connectttl - max hops to livetimeout - timeout in milliseconds
IOException - if I/O operation meets error
IllegalArgumentException - if ttl or timeout is less than zero
public static InetAddress getByAddress(byte[] ipAddress)
throws UnknownHostException
ipAddress[0].
ipAddress - either a 4 (IPv4) or 16 (IPv6) byte array
UnknownHostException
static InetAddress getByAddress(byte[] ipAddress,
int scope_id)
throws UnknownHostException
ipAddress[0].
ipAddress - either a 4 (IPv4) or 16 (IPv6) byte arrayscope_id - the scope id for an IPV6 scoped address. If not a scoped
address just pass in 0
UnknownHostException
public static InetAddress getByAddress(String hostName,
byte[] ipAddress)
throws UnknownHostException
ipAddress[0].
hostName - string representation of hostname or ip addressipAddress - either a 4 (IPv4) or 16 (IPv6) byte array
UnknownHostException
static InetAddress getByAddressInternal(String hostName,
byte[] ipAddress,
int scope_id)
throws UnknownHostException
ipAddress[0].
hostName - string representation of hostname or IP addressipAddress - either a 4 (IPv4) or 16 (IPv6) byte arrayscope_id - the scope id for a scoped address. If not a scoped address
just pass in 0
UnknownHostException
static void intToBytes(int value,
byte[] bytes,
int start)
static int bytesToInt(byte[] bytes,
int start)
static InetAddress createHostNameFromIPAddress(String ipAddressString)
throws UnknownHostException
UnknownHostExceptionstatic boolean preferIPv6Addresses()
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||