Build 1.0_r1(from source)

java.net
Class Inet6Address

java.lang.Object
  extended by java.net.InetAddress
      extended by java.net.Inet6Address
All Implemented Interfaces:
Serializable

public final class Inet6Address
extends InetAddress

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.net.InetAddress
InetAddress.Cache, InetAddress.CacheElement
 
Field Summary
(package private) static InetAddress ANY
           
(package private) static byte[] any_bytes
           
(package private)  String ifname
           
(package private) static byte[] localhost_bytes
           
(package private) static InetAddress LOOPBACK
           
(package private)  int scope_id
           
(package private)  boolean scope_id_set
           
(package private)  boolean scope_ifname_set
           
(package private)  NetworkInterface scopedIf
           
 
Fields inherited from class java.net.InetAddress
family, hostName, ipaddress
 
Constructor Summary
Inet6Address(byte[] address)
           
Inet6Address(byte[] address, int scope_id)
          Constructs an InetAddress, representing the address and hostName and scope_id
Inet6Address(byte[] address, String name)
           
Inet6Address(byte[] address, String name, int scope_id)
          Constructs an InetAddress, representing the address and hostName and scope_id
 
Method Summary
 boolean equals(Object obj)
          Returns true if obj is of the same type as the IPv6 address and they have the same IP address, false otherwise.
static Inet6Address getByAddress(String host, byte[] addr, int scope_id)
          Constructs an IPv6 address according to the given host, addr and scope_id.
static Inet6Address getByAddress(String host, byte[] addr, NetworkInterface nif)
          Constructs an IPv6 address according to the given host, addr and nif.
 String getHostAddress()
          Answer the dotted string IP address representing this address.
 NetworkInterface getScopedInterface()
          Returns the network interface if this address is instanced with a scoped network interface.
 int getScopeId()
          Returns the scope id of this address if it is associated with an interface.
 int hashCode()
          Returns the hashcode of the receiver.
 boolean isAnyLocalAddress()
          Answer true if the InetAddress is the unspecified address "::".
 boolean isIPv4CompatibleAddress()
          An IPv4 compatible address is prefixed with 96 bits of 0's.
 boolean isLinkLocalAddress()
          Answer true if the InetAddress is a link-local address.
 boolean isLoopbackAddress()
          Answer true if the InetAddress is the loopback address The valid IPv6 loopback address is ::1
 boolean isMCGlobal()
          Answer true if the InetAddress is a global multicast address.
 boolean isMCLinkLocal()
          Answer true if the InetAddress is a link-local multicast address.
 boolean isMCNodeLocal()
          Answer true if the InetAddress is a node-local multicast address.
 boolean isMCOrgLocal()
          Answer true if the InetAddress is a org-local multicast address.
 boolean isMCSiteLocal()
          Answer true if the InetAddress is a site-local multicast address.
 boolean isMulticastAddress()
          Answer true if the InetAddress is an IP multicast address.
 boolean isSiteLocalAddress()
          Answer true if the InetAddress is a site-local address.
 String toString()
          Returns a string containing a concise, human-readable description of the address.
 
Methods inherited from class java.net.InetAddress
addressOf, bytesToInt, cacheElement, createHostNameFromIPAddress, getAddress, getAliasesByNameImpl, getAllByName, getByAddress, getByAddress, getByAddress, getByAddressInternal, getByName, getCanonicalHostName, getHostByAddrImpl, getHostByNameImpl, getHostName, getHostNameImpl, getHostNameInternal, getLocalHost, inetAddr, inetAddrImpl, inetNtoaImpl, intToBytes, isReachable, isReachable, lookupHostByName, preferIPv6Addresses
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

any_bytes

static final byte[] any_bytes

localhost_bytes

static final byte[] localhost_bytes

ANY

static final InetAddress ANY

LOOPBACK

static final InetAddress LOOPBACK

scope_id

int scope_id

scope_id_set

boolean scope_id_set

scope_ifname_set

boolean scope_ifname_set

ifname

String ifname

scopedIf

transient NetworkInterface scopedIf
Constructor Detail

Inet6Address

Inet6Address(byte[] address)

Inet6Address

Inet6Address(byte[] address,
             String name)

Inet6Address

Inet6Address(byte[] address,
             String name,
             int scope_id)
Constructs an InetAddress, representing the address and hostName and scope_id

Parameters:
address - network address
name - Name associated with the address
scope_id - The scope id for link or site local addresses

Inet6Address

Inet6Address(byte[] address,
             int scope_id)
Constructs an InetAddress, representing the address and hostName and scope_id

Parameters:
address - network address
scope_id - The scope id for link or site local addresses
Method Detail

getByAddress

public static Inet6Address getByAddress(String host,
                                        byte[] addr,
                                        int scope_id)
                                 throws UnknownHostException
Constructs an IPv6 address according to the given host, addr and scope_id.

Parameters:
host - hostname associated with the address
addr - network address
scope_id - the scope id for link or site local addresses
Returns:
an Inet6Address instance
Throws:
UnknownHostException - if the address is null or of invalid length

getByAddress

public static Inet6Address getByAddress(String host,
                                        byte[] addr,
                                        NetworkInterface nif)
                                 throws UnknownHostException
Constructs an IPv6 address according to the given host, addr and nif. scope_id is set according to the given nif and the addr type(e.g. site local or link local).

Parameters:
host - host name associated with the address
addr - network address
nif - the Network Interface that this address is associated with.
Returns:
an Inet6Address instance
Throws:
UnknownHostException - if the address is null or of invalid length, or the interface doesn't have a numeric scope id for the given address type.

isMulticastAddress

public boolean isMulticastAddress()
Answer true if the InetAddress is an IP multicast address. Valid IPv6 multicast address have the binary prefixed with 11111111 or FF (hex).

Overrides:
isMulticastAddress in class InetAddress
Returns:
boolean true, if the address is in the multicast group, false otherwise

isAnyLocalAddress

public boolean isAnyLocalAddress()
Answer true if the InetAddress is the unspecified address "::".

Overrides:
isAnyLocalAddress in class InetAddress
Returns:
boolean true, if the address is in the multicast group, false otherwise

isLoopbackAddress

public boolean isLoopbackAddress()
Answer true if the InetAddress is the loopback address The valid IPv6 loopback address is ::1

Overrides:
isLoopbackAddress in class InetAddress
Returns:
boolean true if the address is the loopback, false otherwise

isLinkLocalAddress

public boolean isLinkLocalAddress()
Answer true if the InetAddress is a link-local address. A valid IPv6 link-local address is prefixed with 1111111010

Overrides:
isLinkLocalAddress in class InetAddress
Returns:
boolean true, if it is a link-local address, false otherwise

isSiteLocalAddress

public boolean isSiteLocalAddress()
Answer true if the InetAddress is a site-local address. A valid IPv6 site-local address is prefixed with 1111111011

Overrides:
isSiteLocalAddress in class InetAddress
Returns:
boolean true, if it is a site-local address, false otherwise

isMCGlobal

public boolean isMCGlobal()
Answer true if the InetAddress is a global multicast address. A valid IPv6 global multicast address is 11111111xxxx1110 (i.e. FF0E)

Overrides:
isMCGlobal in class InetAddress
Returns:
boolean true, if it is a global multicast address, false otherwise

isMCNodeLocal

public boolean isMCNodeLocal()
Answer true if the InetAddress is a node-local multicast address. A valid IPv6 node-local multicast address is prefixed with 11111111xxxx0001

Overrides:
isMCNodeLocal in class InetAddress
Returns:
boolean true, if it is a node-local multicast address, false otherwise

isMCLinkLocal

public boolean isMCLinkLocal()
Answer true if the InetAddress is a link-local multicast address. A valid IPv6 link-local multicast address is prefixed with 11111111xxxx0010

Overrides:
isMCLinkLocal in class InetAddress
Returns:
boolean true, if it is a link-local multicast address, false otherwise

isMCSiteLocal

public boolean isMCSiteLocal()
Answer true if the InetAddress is a site-local multicast address. A valid IPv6 site-local multicast address is prefixed with 11111111xxxx0101

Overrides:
isMCSiteLocal in class InetAddress
Returns:
boolean true, if it is a site-local multicast address, false otherwise

isMCOrgLocal

public boolean isMCOrgLocal()
Answer true if the InetAddress is a org-local multicast address. A valid IPv6 org-local multicast address is prefixed with 11111111xxxx1000

Overrides:
isMCOrgLocal in class InetAddress
Returns:
boolean true, if it is a org-local multicast address, false otherwise

getHostAddress

public String getHostAddress()
Description copied from class: InetAddress
Answer the dotted string IP address representing this address.

Overrides:
getHostAddress in class InetAddress
Returns:
String the corresponding dotted string IP address

getScopeId

public int getScopeId()
Returns the scope id of this address if it is associated with an interface. Otherwise returns zero.

Returns:
the scope_id.

getScopedInterface

public NetworkInterface getScopedInterface()
Returns the network interface if this address is instanced with a scoped network interface. Otherwise returns null.

Returns:
the scoped network interface.

hashCode

public int hashCode()
Returns the hashcode of the receiver.

Overrides:
hashCode in class InetAddress
Returns:
the hashcode
See Also:
Object.equals(java.lang.Object)

equals

public boolean equals(Object obj)
Returns true if obj is of the same type as the IPv6 address and they have the same IP address, false otherwise. the scope id does not seem to be part of the comparison

Overrides:
equals in class InetAddress
Parameters:
obj - the object to be tested for equality
Returns:
String
See Also:
Object.hashCode()

isIPv4CompatibleAddress

public boolean isIPv4CompatibleAddress()
An IPv4 compatible address is prefixed with 96 bits of 0's. The last 32-bits are varied corresponding with the 32-bit IPv4 address space.


toString

public String toString()
Returns a string containing a concise, human-readable description of the address.

Overrides:
toString in class InetAddress
Returns:
String the description, as host/address

Build 1.0_r1(from source)

Please submit a feedback, bug or feature