- All Implemented Interfaces:
Serializable
- Enclosing class:
IPv6Address
An IPv6 zone distinguishes two IPv6 addresses that are the same. They are used with link-local addresses fe80::/10 to distinguish two interfaces to the link-local network, this is known as the zone id. They are used with site-local addresses to distinguish sites, using the site id, also known as the scope id.
A zone that consists of a scope id is called a scoped zone.
An IPv6 zone will reference an interface by a scoped identifier number or by interface name based on how it was constructed. If constructed with a numeric identifier, whether integer or string, it will always reference by scoped identifier. Otherwise, it will always reference by interface name.
Once constructed, it will always reference using the same method, either interface name or scope id. To reference by the other method you must use a different IPv6Zone instance.
Even though it will always reference using the same method, you can use the IPv6Zone instance to look up the scope id if the instance references by interface name, or to look up the associated interface if the instance references by scope id.
- Author:
- scfoley
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionIPv6Zone
(int scopeId) Constructs a zone that will use a scope identifier with the address.Constructs a zone that will use the given zone string, either a non-negative integer indicating a scope identifier, or the name of a network interface.IPv6Zone
(NetworkInterface networkInterface) Constructs a zone that will use an interface name with the address. -
Method Summary
Modifier and TypeMethodDescriptionboolean
If this zone references a network interface, returns that interface, or null if no interface with the given name exists on the system.Returns the MAC address of the associated interfaceint
If this zone references a scoped identifier, returns that identifier.getName()
int
hashCode()
boolean
Whether this zone references a network interface.boolean
Whether this zone references a scope identifier.toString()
-
Constructor Details
-
IPv6Zone
Constructs a zone that will use the given zone string, either a non-negative integer indicating a scope identifier, or the name of a network interface.A scope identifier is indicated by a sequence of decimal digits.
To create an InetAddress by pairing this zone with an IPv6Address instance, an interface name must reference an existing interface, otherwise the InetAddress cannot be created.
See
NetworkInterface
to get a list of existing interfaces or to look up interfaces by name.- Parameters:
zoneStr
-
-
IPv6Zone
public IPv6Zone(int scopeId) Constructs a zone that will use a scope identifier with the address.- Parameters:
scopeId
-
-
IPv6Zone
Constructs a zone that will use an interface name with the address.- Parameters:
networkInterface
-
-
-
Method Details
-
referencesIntf
public boolean referencesIntf()Whether this zone references a network interface.- Returns:
-
referencesScopeId
public boolean referencesScopeId()Whether this zone references a scope identifier.- Returns:
-
getAssociatedIntf
If this zone references a network interface, returns that interface, or null if no interface with the given name exists on the system. If this zone references a scope id, returns the associated interface.- Returns:
-
getAssociatedIntfMacAddr
Returns the MAC address of the associated interface- Returns:
-
getAssociatedScopeId
public int getAssociatedScopeId()If this zone references a scoped identifier, returns that identifier.If this zone references a network interface, returns the scope identifier for the addresses of that interface, or -1 if the referenced interface cannot be found on the system, or no single scope identifier was assigned.
- Returns:
-
hashCode
public int hashCode() -
equals
-
getName
-
toString
-