public final class IPv6Address extends Object implements Comparable<IPv6Address>
Modifier and Type | Field and Description |
---|---|
static IPv6Address |
MAX |
Modifier and Type | Method and Description |
---|---|
IPv6Address |
add(int value)
Addition.
|
int |
compareTo(IPv6Address that) |
boolean |
equals(Object o) |
static IPv6Address |
fromBigInteger(BigInteger bigInteger)
Create an IPv6 address from a (positive)
BigInteger . |
static IPv6Address |
fromByteArray(byte[] bytes)
Create an IPv6 address from a byte array.
|
static IPv6Address |
fromInetAddress(InetAddress inetAddress)
Create an IPv6 address from a java.net.Inet6Address.
|
static IPv6Address |
fromLongs(long highBits,
long lowBits)
Construct an IPv6Address from two longs representing the 64 highest and 64 lowest bits.
|
static IPv6Address |
fromString(String string)
Create an IPv6 address from its String representation.
|
long |
getHighBits() |
long |
getLowBits() |
int |
hashCode() |
boolean |
isIPv4Mapped()
Returns true if the address is an IPv4-mapped IPv6 address.
|
boolean |
isLinkLocal() |
boolean |
isMulticast() |
boolean |
isSiteLocal() |
IPv6Address |
maskWithNetworkMask(IPv6NetworkMask networkMask)
Mask the address with the given network mask.
|
IPv6Address |
maximumAddressWithNetworkMask(IPv6NetworkMask networkMask)
Calculate the maximum address with the given network mask.
|
int |
numberOfLeadingOnes() |
int |
numberOfLeadingZeroes() |
int |
numberOfTrailingOnes() |
int |
numberOfTrailingZeroes() |
IPv6Address |
setBit(int bit)
Set a bit in the address.
|
IPv6Address |
subtract(int value)
Subtraction.
|
BigInteger |
toBigInteger() |
byte[] |
toByteArray() |
InetAddress |
toInetAddress() |
String |
toLongString() |
String |
toString()
Returns a string representation of the IPv6 address.
|
public static final IPv6Address MAX
public static IPv6Address fromLongs(long highBits, long lowBits)
String
or an InetAddress
. The internal representation of an IPv6Address is exactly
these two longs though, so if you already happen to have them, this provides a very efficient way to construct an IPv6Address.highBits
- highest order bitslowBits
- lowest order bitspublic static IPv6Address fromString(String string)
string
- string representationpublic static IPv6Address fromInetAddress(InetAddress inetAddress)
inetAddress
- Inet6Address representationpublic InetAddress toInetAddress() throws UnknownHostException
UnknownHostException
public static IPv6Address fromByteArray(byte[] bytes)
bytes
- byte array with 16 bytes (interpreted unsigned)public byte[] toByteArray()
public static IPv6Address fromBigInteger(BigInteger bigInteger)
BigInteger
. The magnitude of the BigInteger
represents
the IPv6 address value. Or in other words, the BigInteger
with value N defines the Nth possible IPv6 address.bigInteger
- BigInteger
valuepublic BigInteger toBigInteger()
BigInteger
representation. The magnitude of the BigInteger
represents the IPv6 address
value. Or in other words, the BigInteger
with value N defines the Nth possible IPv6 address.public IPv6Address add(int value)
value
- value to addpublic IPv6Address subtract(int value)
value
- value to substractpublic IPv6Address maskWithNetworkMask(IPv6NetworkMask networkMask)
networkMask
- network maskpublic IPv6Address maximumAddressWithNetworkMask(IPv6NetworkMask networkMask)
networkMask
- network maskpublic IPv6Address setBit(int bit)
bit
- to set (in the range [0, 127])public boolean isIPv4Mapped()
public boolean isMulticast()
public boolean isSiteLocal()
public boolean isLinkLocal()
public String toString()
public String toLongString()
public int compareTo(IPv6Address that)
compareTo
in interface Comparable<IPv6Address>
public long getHighBits()
public long getLowBits()
public int numberOfTrailingZeroes()
public int numberOfTrailingOnes()
public int numberOfLeadingZeroes()
public int numberOfLeadingOnes()
Copyright © 2015. All Rights Reserved.