java.net
public
final
class
java.net.Inet6Address
Summary
Public Methods
equals,
getAddress,
getAllByName,
getByAddress,
getByAddress,
getByName,
getCanonicalHostName,
getHostAddress,
getHostName,
getLocalHost,
hashCode,
isAnyLocalAddress,
isLinkLocalAddress,
isLoopbackAddress,
isMCGlobal,
isMCLinkLocal,
isMCNodeLocal,
isMCOrgLocal,
isMCSiteLocal,
isMulticastAddress,
isReachable,
isReachable,
isSiteLocalAddress,
toString
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
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 |
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. |
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 |
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 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.
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