IpAddress.Version
Modifier and Type | Field and Description |
---|---|
static int |
BIT_LENGTH |
static int |
BYTE_LENGTH |
static IpAddress.Version |
VERSION |
static Ip4Address |
ZERO
All-zero unspecified IPv4 address.
|
INET_BIT_LENGTH, INET_BYTE_LENGTH, INET6_BIT_LENGTH, INET6_BYTE_LENGTH
Modifier and Type | Method and Description |
---|---|
static Ip4Address |
makeMaskedAddress(Ip4Address address,
int prefixLength)
Creates an IPv4 address by masking it with a network mask of given
mask length.
|
static Ip4Address |
makeMaskPrefix(int prefixLength)
Creates an IPv4 network mask prefix.
|
int |
toInt()
Returns the integer value of this IPv4 address.
|
static Ip4Address |
valueOf(byte[] value)
Converts a byte array into an IPv4 address.
|
static Ip4Address |
valueOf(byte[] value,
int offset)
Converts a byte array and a given offset from the beginning of the
array into an IPv4 address.
|
static Ip4Address |
valueOf(java.net.InetAddress inetAddress)
Converts an InetAddress into an IPv4 address.
|
static Ip4Address |
valueOf(int value)
Converts an integer into an IPv4 address.
|
static Ip4Address |
valueOf(java.lang.String value)
Converts an IPv4 string literal (e.g., "10.2.3.4") into an IP address.
|
byteLength, compareTo, equals, getIp4Address, getIp6Address, hashCode, isIp4, isIp6, isLinkLocal, isMulticast, isSelfAssigned, isZero, makeMaskedAddress, makeMaskPrefix, toInetAddress, toIpPrefix, toOctets, toString, valueOf, valueOf, version
public static final IpAddress.Version VERSION
public static final int BYTE_LENGTH
public static final int BIT_LENGTH
public static final Ip4Address ZERO
public int toInt()
public static Ip4Address valueOf(int value)
value
- an integer representing an IPv4 address valuepublic static Ip4Address valueOf(byte[] value)
value
- the IPv4 address value stored in network byte order
(i.e., the most significant byte first)java.lang.IllegalArgumentException
- if the argument is invalidpublic static Ip4Address valueOf(byte[] value, int offset)
The IP address is stored in network byte order (i.e., the most significant byte first).
value
- the value to useoffset
- the offset in bytes from the beginning of the byte arrayjava.lang.IllegalArgumentException
- if the arguments are invalidpublic static Ip4Address valueOf(java.net.InetAddress inetAddress)
inetAddress
- the InetAddress value to use. It must contain an IPv4
addressjava.lang.IllegalArgumentException
- if the argument is invalidpublic static Ip4Address valueOf(java.lang.String value)
value
- an IPv4 address value in string formjava.lang.IllegalArgumentException
- if the argument is invalidpublic static Ip4Address makeMaskPrefix(int prefixLength)
prefixLength
- the length of the mask prefix. Must be in the
interval [0, 32]java.lang.IllegalArgumentException
- if the argument is invalidpublic static Ip4Address makeMaskedAddress(Ip4Address address, int prefixLength)
address
- the address to maskprefixLength
- the length of the mask prefix. Must be in the
interval [0, 32]java.lang.IllegalArgumentException
- if the prefix length is invalid