public final class IPv6Address extends IPAddress<IPv6Address>
| Modifier and Type | Field and Description |
|---|---|
static IPv6Address |
LOCALHOST
An IPv6 address object for localhost,
::1. |
static IPv6Address |
MAX_VALUE
The maximum IPv6 address object,
ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff. |
static IPv6Address |
MIN_VALUE
The minimum IPv6 address object,
::. |
| Modifier and Type | Method and Description |
|---|---|
IPv6Range |
asRange()
Returns an IP range containing only this IP address.
|
int |
bits()
Returns the number of bits required to store the IP address, always
128. |
int |
compareTo(IPv6Address other) |
boolean |
equals(Object o)
Tests whether or not another object is equal to this IP address.
|
int |
hashCode()
Returns a hash code value for this IP address.
|
boolean |
hasNext()
Returns whether or not there is a next IP address.
|
boolean |
hasPrevious()
Returns whether or not there is a previous IP address.
|
static Predicate<CharSequence> |
ifValidIPv6Address(Predicate<? super IPv6Address> predicate)
Returns a predicate that checks whether or not
CharSequences are valid IPv6 addresses that match a specific predicate. |
IPv6Subnet |
inSubnet(int prefixLength)
Returns a subnet of a specific prefix length that contains this IP address.
|
boolean |
isIPv4Mapped()
Returns whether or not this IPv6 address is an IPv4 mapped address.
|
static boolean |
isIPv6Address(CharSequence s)
Tests whether or not a
CharSequence is a valid IPv6 address. |
static boolean |
isIPv6Address(CharSequence s,
int start,
int end)
Tests whether or not a portion of a
CharSequence is a valid IPv6 address. |
boolean |
isLinkLocalAddress()
Returns whether or not this IP address is a link local address.
|
boolean |
isLoopbackAddress()
Returns whether or not this IP address is a loopback address.
|
boolean |
isMulticastAddress()
Returns whether or not this IP address is an IP multicast address.
|
boolean |
isSiteLocalAddress()
Returns whether or not this IP address is a site local address.
|
boolean |
isWildcardAddress()
Returns whether or not this IP address is a wildcard address.
|
IPv6Address |
next()
Returns the next IP address if it exists.
|
IPv6Address |
previous()
Returns the previous IP address if it exists.
|
IPv6Range |
to(IPv6Address end)
Returns an IP range starting at this IP address and ending in another IP address.
|
byte[] |
toByteArray()
Returns a byte array representation of this IP address.
|
IPv4Address |
toIPv4()
Returns an IPv4 representation of this IPv6 address if it is an IPv4 mapped address.
|
static Optional<IPv6Address> |
tryValueOfIPv6(CharSequence address)
Attempts to return an IPv6 address represented by a
CharSequence. |
static Optional<IPv6Address> |
tryValueOfIPv6(CharSequence address,
int start,
int end)
Attempts to return an IPv6 address represented by a portion of a
CharSequence. |
static IPv6Address |
valueOf(byte[] address)
Returns an IPv6 address from a byte array representation of the address.
|
static IPv6Address |
valueOf(CharSequence address)
Returns an IPv6 address represented by a
CharSequence. |
static IPv6Address |
valueOf(CharSequence address,
int start,
int end)
Returns an IPv6 address represented by a portion of a
CharSequence. |
static IPv6Address |
valueOf(Inet6Address address)
Returns an IPv6 address represented by a
Inet6Address. |
static IPv6Address |
valueOf(int hextet1,
int hextet2,
int hextet3,
int hextet4,
int hextet5,
int hextet6,
int hextet7,
int hextet8)
Returns an IPv6 address from eight hextets.
|
ifValidIPAddress, isIPAddress, isIPAddress, toInetAddress, toString, tryValueOf, tryValueOf, valueOfpublic static final IPv6Address LOCALHOST
::1.public static final IPv6Address MIN_VALUE
::.public static final IPv6Address MAX_VALUE
ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff.public int bits()
128.bits in class IPAddress<IPv6Address>public byte[] toByteArray()
IPAddressIPAddress.bits() divided by Byte.SIZE.
Furthermore, the result is in network byte order; the highest order byte is in the first element.toByteArray in class IPAddress<IPv6Address>public IPv4Address toIPv4()
d.d.d.d if this IPv6 address is ::ffff:d.d.d.d.IllegalStateException - If this IPv6 address is not an IPv4 mapped address.isIPv4Mapped()public boolean isIPv4Mapped()
::ffff:0:0/96 subnet (from ::ffff:0:0 to ::ffff:ffff:ffff).true if this IPv6 address is an IPv4 mapped address, or false otherwise.public boolean equals(Object o)
IPAddressIPAddress.toByteArray().
Implementations do not necessary need to use IPAddress.toByteArray(), as long as equal IP addresses also have equal byte array representations.
equals in class IPAddress<IPv6Address>public int hashCode()
IPAddress
Implementations do not necessarily need to use IPAddress.toByteArray(), as long as the general contract as specified by
Object.hashCode() is not violated.
hashCode in class IPAddress<IPv6Address>public int compareTo(IPv6Address other)
public boolean isMulticastAddress()
ff00::/8.isMulticastAddress in class IPAddress<IPv6Address>true if this IP address is an IP multicast address, or false otherwise.Inet6Address.isMulticastAddress()public boolean isWildcardAddress()
isWildcardAddress in class IPAddress<IPv6Address>true if this IP address is a wildcard address, or false otherwise.Inet6Address.isAnyLocalAddress()public boolean isLoopbackAddress()
isLoopbackAddress in class IPAddress<IPv6Address>true if this IP address is a loopback address, or false otherwise.Inet6Address.isLoopbackAddress()public boolean isLinkLocalAddress()
fe80::/10 subnet.isLinkLocalAddress in class IPAddress<IPv6Address>true if this IP address is a link local address, or false otherwise.Inet6Address.isLinkLocalAddress()public boolean isSiteLocalAddress()
fec0::/10 subnets.isSiteLocalAddress in class IPAddress<IPv6Address>true if this IP address is a site local address, or false otherwise.Inet6Address.isSiteLocalAddress()public boolean hasNext()
IPAddresshasNext in class IPAddress<IPv6Address>true if there is a next IP address, or false otherwise.public IPv6Address next()
IPAddressnext in class IPAddress<IPv6Address>IPAddress.hasNext()public boolean hasPrevious()
IPAddresshasPrevious in class IPAddress<IPv6Address>true if there is a previous IP address, or false otherwise.public IPv6Address previous()
IPAddressprevious in class IPAddress<IPv6Address>IPAddress.hasPrevious()public IPv6Range to(IPv6Address end)
IPAddressto in class IPAddress<IPv6Address>end - The end of the IP range, inclusive.public IPv6Range asRange()
IPAddressasRange in class IPAddress<IPv6Address>public IPv6Subnet inSubnet(int prefixLength)
IPAddressinSubnet in class IPAddress<IPv6Address>prefixLength - The prefix length of the subnet to return.public static IPv6Address valueOf(int hextet1, int hextet2, int hextet3, int hextet4, int hextet5, int hextet6, int hextet7, int hextet8)
valueOf(0xFF, 0xAB, 0, 0, 0, 0, 0, 1) will return an IPv6 address that represents ff:ab::1.hextet1 - The first hextet.hextet2 - The second hextet.hextet3 - The third hextet.hextet4 - The fourth hextet.hextet5 - The fifth hextet.hextet6 - The sixth hextet.hextet7 - The seventh hextet.hextet8 - The eighth hextet.IllegalArgumentException - If any of the octets is not between 0 and 0xFFFF, inclusive.public static IPv6Address valueOf(byte[] address)
address - The array to return an IPv6 address for.NullPointerException - If the given array is null.IllegalArgumentException - If the length of the given array is not 16.public static IPv6Address valueOf(CharSequence address)
CharSequence.address - The IPv6 address as a CharSequence.NullPointerException - If the given CharSequence is null.IllegalArgumentException - If the given CharSequence does not represent a valid IPv6 address.public static IPv6Address valueOf(CharSequence address, int start, int end)
CharSequence.address - The IPv6 address as a CharSequence.start - The index in the CharSequence where the IPv6 address starts, inclusive.end - The index in the CharSequence where the IPv6 address ends, exclusive.NullPointerException - If the given CharSequence is null.IndexOutOfBoundsException - If the start index is negative, or if the end index is larger than the length of the CharSequence,
or if the start index is larger than the end index.IllegalArgumentException - If the given CharSequence does not represent a valid IPv6 address.public static Optional<IPv6Address> tryValueOfIPv6(CharSequence address)
CharSequence.address - The possible IPv6 address as a CharSequence.Optional with the IPv6 address that represents the given address, or Optional.empty() if the given
CharSequence is nullor does not represent a valid IPv6 address.public static Optional<IPv6Address> tryValueOfIPv6(CharSequence address, int start, int end)
CharSequence.address - The possible IPv6 address as a CharSequence.start - The index in the CharSequence where the IPv6 address starts, inclusive.end - The index in the CharSequence where the IPv6 address ends, exclusive.Optional with the IPv6 address that represents the given address, or Optional.empty() if the given
CharSequence is nullor does not represent a valid IPv6 address.IndexOutOfBoundsException - If the start index is negative, or if the end index is larger than the length of the CharSequence,
or if the start index is larger than the end index (unless if the CharSequence is null).public static IPv6Address valueOf(Inet6Address address)
Inet6Address.address - The IPv6 address as a Inet6Address.NullPointerException - If the given Inet6Address is null.public static boolean isIPv6Address(CharSequence s)
CharSequence is a valid IPv6 address.s - The CharSequence to test.true if the given CharSequence is a valid IPv6 address, or false otherwise.public static boolean isIPv6Address(CharSequence s, int start, int end)
CharSequence is a valid IPv6 address.s - The CharSequence to test.start - The index in the CharSequence to start checking at, inclusive.end - The index in the CharSequence to end checking at, exclusive.true if the given CharSequence is a valid IPv6 address, or false otherwise.IndexOutOfBoundsException - If the start index is negative, or if the end index is larger than the length of the CharSequence,
or if the start index is larger than the end index (unless if the CharSequence is null).public static Predicate<CharSequence> ifValidIPv6Address(Predicate<? super IPv6Address> predicate)
CharSequences are valid IPv6 addresses that match a specific predicate.
This predicate can handle null values, which do not match the predicate.predicate - The predicate to check if CharSequences are valid IP addresses.CharSequences are valid IP addresses that match the given predicate.isIPv6Address(CharSequence)Copyright © 2019–2023. All rights reserved.