Save This Page
Home » apache-harmony-6.0-src-r917296-snapshot » java » net » [javadoc | source]
java.net
public final class: Inet4Address [javadoc | source]
java.lang.Object
   java.net.InetAddress
      java.net.Inet4Address

All Implemented Interfaces:
    Serializable

This class represents a 32 bit long IPv4 address. The most common textual representation of an IPv4 address follows the pattern {@code b.b.b.b} where each {@code b} represents one of the four bytes. If only three parts are specified ({@code b.b.bb} ), the last part is then 16 bit long, the address represents a class B network address as 128.net.host. A two part address ({@code b.bbb} ) allows to represent a class A network address as net.host. If there is only one part ({@code bbbb} ) the address is represented without any byte rearrangement.
Fields inherited from java.net.InetAddress:
any_bytes,  localhost_bytes,  ANY,  LOOPBACK,  hostName,  family,  ipaddress
Constructor:
 Inet4Address(byte[] address) 
 Inet4Address(byte[] address,
    String name) 
Method from java.net.Inet4Address Summary:
equals,   getHostAddress,   hashCode,   isAnyLocalAddress,   isLinkLocalAddress,   isLoopbackAddress,   isMCGlobal,   isMCLinkLocal,   isMCNodeLocal,   isMCOrgLocal,   isMCSiteLocal,   isMulticastAddress,   isSiteLocalAddress
Methods from java.net.InetAddress:
bytesToInt,   cacheElement,   createHostNameFromIPAddress,   equals,   getAddress,   getAliasesByNameImpl,   getAllByName,   getByAddress,   getByAddress,   getByAddress,   getByAddressInternal,   getByName,   getCanonicalHostName,   getHostAddress,   getHostByAddrImpl,   getHostByNameImpl,   getHostName,   getHostNameImpl,   getHostNameInternal,   getLocalHost,   hashCode,   inetAddr,   inetAddrImpl,   inetNtoaImpl,   intToBytes,   isAnyLocalAddress,   isLinkLocalAddress,   isLoopbackAddress,   isMCGlobal,   isMCLinkLocal,   isMCNodeLocal,   isMCOrgLocal,   isMCSiteLocal,   isMulticastAddress,   isReachable,   isReachable,   isSiteLocalAddress,   lookupHostByName,   preferIPv6Addresses,   toString
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.net.Inet4Address Detail:
 public boolean equals(Object obj) 
    Compares this instance with the IP address in the object {@code obj} and returns {@code true} if they are of the same type and represent the same IP address, {@code false} otherwise.
 public String getHostAddress() 
    Returns a textual representation of this IP address.
 public int hashCode() 
    Gets the hashcode of the represented IP address.
 public boolean isAnyLocalAddress() 
    Returns whether the represented address is the local wildcard ANY address or not.
 public boolean isLinkLocalAddress() 
    Returns whether this address has a link-local scope or not.

    RFC 3484
    Default Address Selection for Internet Protocol Version 6 (IPv6) states IPv4 auto-configuration addresses, prefix 169.254/16, IPv4 loopback addresses, prefix 127/8, are assigned link-local scope.

 public boolean isLoopbackAddress() 
    Returns whether the represented address is a loopback address or not. Loopback IPv4 addresses are prefixed with: 011111111 = 127.
 public boolean isMCGlobal() 
    Returns whether the address is a global multicast address or not. Valid MCGlobal IPv4 addresses are 224.0.1.0 - 238.255.255.255.
 public boolean isMCLinkLocal() 
    Returns whether the address is a link-local multicast address or not. The valid range for IPv4 link-local addresses is: 224.0.0.0 to 239.0.0.255 Hence a mask of 111000000000000000000000 = 0xE00000.
 public boolean isMCNodeLocal() 
    Returns whether the address has a node-local scope or not. This method returns always {@code false} because there are no valid IPv4 node-local addresses.
 public boolean isMCOrgLocal() 
    Returns whether the address is a organization-local multicast address or not. The valid range for IPv4 organization-local addresses is: 239.192.0.0 to 239.195.255.255 Hence masks of 11101111 11000000 to 11101111 11000011 are valid. 0xEFC0 to 0xEFC3
 public boolean isMCSiteLocal() 
    Returns whether the address is a site-local multicast address or not. The valid range for IPv4 site-local addresses is: 239.255.0.0 to 239.255.255.255 Hence a mask of 11101111 11111111 = 0xEFFF.
 public boolean isMulticastAddress() 
    Returns whether the represented address is a multicast address or not. Valid IPv4 multicast addresses are prefixed with 1110 = 0xE.
 public boolean isSiteLocalAddress() 
    Returns whether this address has a site-local scope or not.

    RFC 3484
    Default Address Selection for Internet Protocol Version 6 (IPv6) states IPv4 private addresses, prefixes 10/8, 172.16/12, and 192.168/16, are assigned site-local scope.