public abstract class IPAddress
extends java.lang.Object
implements java.io.Serializable
| Constructor and Description |
|---|
IPAddress() |
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
is6To4()
Checks whether the given address is a 6to4 address
|
abstract boolean |
isLinkLocal()
Checks whether the address is link-local
|
abstract boolean |
isLoopback()
Checks whether the address is a loopback address
|
abstract boolean |
isMartian()
Martian addresses are reserved and private addresses that should not
appear on the public internet
|
abstract boolean |
isMulticast()
Checks whether the address is part of a range reserved for multicast
|
abstract boolean |
isPrivate()
Checks whether the address is private
|
abstract boolean |
isReserved()
Checks whether the address part of a reserved range
|
abstract boolean |
isUnspecified()
Checks whether the address is "unspecified"
|
abstract IPAddress |
minus(int n)
Return an address smaller than the current one by n, with wraparound
|
abstract IPAddress |
next()
Returns the following address, with wraparound
|
static IPAddress |
of(byte[] bigEndianByteArr)
Returns either an IPv4 or an IPv6 address
|
static IPAddress |
of(java.net.InetAddress address)
Returns either an IPv4 or an IPv6 address built from an InetAddress
|
static IPAddress |
of(java.lang.String ip)
Returns either an IPv4 or an IPv6 address
|
abstract IPAddress |
plus(int n)
Return an address larger than the current one by n, with wraparound
|
abstract IPAddress |
previous()
Returns the previous address, with wraparound
|
byte[] |
toArray()
The address as an array of bytes, with the highest byte first
|
abstract byte[] |
toBigEndianArray()
The address as an array of bytes, with the highest byte first
|
java.math.BigInteger |
toBigInteger()
The address as a BigInteger, unsigned
|
java.net.InetAddress |
toInetAddress()
The address as an InetAddress
|
abstract byte[] |
toLittleEndianArray()
The address as an array of bytes, with the highest byte last
|
java.math.BigInteger |
toSignedBigInteger()
The address as a BigInteger, signed
|
abstract int |
version()
Returns the version of the IP address
|
public static IPAddress of(byte[] bigEndianByteArr)
bigEndianByteArr - array of 4 or 16 bytesjava.lang.IllegalArgumentException - if the given array isn't 4 or 16 bytes longpublic static IPAddress of(java.lang.String ip)
ip - an IPv4 or IPv6 address in literal String formjava.lang.IllegalArgumentException - if the given array isn't an IPv4/IPv6 addresspublic static IPAddress of(java.net.InetAddress address)
address - to copy frompublic abstract boolean is6To4()
public abstract boolean isMartian()
public abstract boolean isLoopback()
public abstract boolean isMulticast()
public abstract boolean isPrivate()
public abstract boolean isReserved()
public abstract boolean isUnspecified()
public abstract boolean isLinkLocal()
public abstract int version()
public abstract IPAddress next()
public abstract IPAddress plus(int n)
n - public abstract IPAddress previous()
public abstract IPAddress minus(int n)
n - public abstract byte[] toBigEndianArray()
public abstract byte[] toLittleEndianArray()
public byte[] toArray()
public java.math.BigInteger toBigInteger()
public java.math.BigInteger toSignedBigInteger()
public java.net.InetAddress toInetAddress()