Android
java.net
public final class

java.net.Inet4Address

java.lang.Object
java.net.InetAddress Serializable
java.net.Inet4Address

Summary

Public Methods

          boolean  equals(Object obj)
Returns true if obj is of the same type as the IPv4 address and they have the same IP address, false otherwise.
          String  getHostAddress()
Returns a String representation of the IP address.
          int  hashCode()
Overrides the basic hashcode function.
          boolean  isAnyLocalAddress()
Returns if the address is the ANY Address
          boolean  isLinkLocalAddress()
Returns whether this address has link-local scope.
          boolean  isLoopbackAddress()
Returns true if the address is a loopback address.
          boolean  isMCGlobal()
Returns true if an address is a global multicast address.
          boolean  isMCLinkLocal()
Returns true if the address is a link-local address.The valid range for IPv4 link-local addresses is: 224.0.0.0 to 239.0.0.255 Hence a mask of 111000000000000000000000 = 0xE00000
          boolean  isMCNodeLocal()
Returns false for all IPv4 addresses.
          boolean  isMCOrgLocal()
Returns true if the address is a organization-local address.
          boolean  isMCSiteLocal()
Returns true if the address is a site-local address.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.
          boolean  isMulticastAddress()
Returns true if the address is a multicast address.
          boolean  isSiteLocalAddress()
Returns whether this address has site-local scope.
Methods inherited from class java.net.InetAddress
Methods inherited from class java.lang.Object

Details

Public Methods

public boolean equals(Object obj)

Returns true if obj is of the same type as the IPv4 address and they have the same IP address, false otherwise.

Parameters

obj the object to be tested for equality

Returns

  • true if equal and false otherwise

public String getHostAddress()

Returns a String representation of the IP address.

Returns

  • Host address

public int hashCode()

Overrides the basic hashcode function.

Returns

  • the hash code

public boolean isAnyLocalAddress()

Returns if the address is the ANY Address

Returns

  • boolean

public boolean isLinkLocalAddress()

Returns whether this address has link-local scope. 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.

Returns

  • boolean

public boolean isLoopbackAddress()

Returns true if the address is a loopback address. Loopback ipv4 addresses are prefixed with: 011111111 = 127

Returns

  • boolean

public boolean isMCGlobal()

Returns true if an address is a global multicast address. Valid MCGlobal IPv4 addresses are 224.0.1.0 - 238.255.255.255

Returns

  • boolean true, if the address is in the global multicast group, false otherwise

public boolean isMCLinkLocal()

Returns true if the address is a link-local address.The valid range for IPv4 link-local addresses is: 224.0.0.0 to 239.0.0.255 Hence a mask of 111000000000000000000000 = 0xE00000

Returns

  • boolean

public boolean isMCNodeLocal()

Returns false for all IPv4 addresses. There are no valid IPv4 Node-local addresses

Returns

  • boolean

public boolean isMCOrgLocal()

Returns true if the address is a organization-local address. The valid range for IPv4 org-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

Returns

  • true if org local address, false otherwise

public boolean isMCSiteLocal()

Returns true if the address is a site-local address.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.

Returns

  • boolean

public boolean isMulticastAddress()

Returns true if the address is a multicast address. Valid IPv4 multicast addresses are prefixed with 1110 = 0xE

Returns

  • boolean

public boolean isSiteLocalAddress()

Returns whether this address has site-local scope. 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.

Returns

  • boolean
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:48