加载中...
The Wayback Machine - https://sup1a9wrlpyh5li9ro.vcoronado.top/web/20090228222555/http://developer.android.com:80/reference/java/net/Inet6Address.html
public final class

Inet6Address

extends InetAddress
java.lang.Object
   ↳ java.net.InetAddress
     ↳ java.net.Inet6Address

Summary

Public Methods
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, NetworkInterface nif)
Constructs an IPv6 address according to the given host, addr and nif.
static Inet6Address getByAddress(String host, byte[] addr, int scope_id)
Constructs an IPv6 address according to the given host, addr and scope_id.
String getHostAddress()
Answer the dotted string IP address representing this address.
int getScopeId()
Returns the scope id of this address if it is associated with an interface.
NetworkInterface getScopedInterface()
Returns the network interface if this address is instanced with a scoped network 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.
[Expand]
Inherited Methods
From class java.net.InetAddress
From class java.lang.Object

Public Methods

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

Parameters
obj the object to be tested for equality
Returns
  • String

public static Inet6Address getByAddress (String host, byte[] addr, NetworkInterface nif)

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.

public static Inet6Address getByAddress (String host, byte[] addr, int scope_id)

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

public String getHostAddress ()

Answer the dotted string IP address representing this address.

Returns
  • String the corresponding dotted string IP address

public int getScopeId ()

Returns the scope id of this address if it is associated with an interface. Otherwise returns zero.

Returns
  • the scope_id.

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.

public int hashCode ()

Returns the hashcode of the receiver.

Returns
  • the hashcode

public boolean isAnyLocalAddress ()

Answer true if the InetAddress is the unspecified address "::".

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

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.

public boolean isLinkLocalAddress ()

Answer true if the InetAddress is a link-local address. A valid IPv6 link-local address is prefixed with 1111111010

Returns
  • boolean true, if it is a link-local address, false otherwise

public boolean isLoopbackAddress ()

Answer true if the InetAddress is the loopback address The valid IPv6 loopback address is ::1

Returns
  • boolean true if the address is the loopback, false otherwise

public boolean isMCGlobal ()

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

Returns
  • boolean true, if it is a global multicast address, false otherwise

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

Returns
  • boolean true, if it is a link-local multicast address, false otherwise

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

Returns
  • boolean true, if it is a node-local multicast address, false otherwise

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

Returns
  • boolean true, if it is a org-local multicast address, false otherwise

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

Returns
  • boolean true, if it is a site-local multicast address, false otherwise

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).

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

public boolean isSiteLocalAddress ()

Answer true if the InetAddress is a site-local address. A valid IPv6 site-local address is prefixed with 1111111011

Returns
  • boolean true, if it is a site-local address, false otherwise

public String toString ()

Returns a string containing a concise, human-readable description of the address.

Returns
  • String the description, as host/address