public class InetAddressUtil extends Object
| Constructor and Description |
|---|
InetAddressUtil() |
| Modifier and Type | Method and Description |
|---|---|
static InetAddress |
convertToInetAddressIfPossible(CharSequence address)
Converts a CharSequence to an InetAddress if it represents a valid IP address.
|
static Inet4Address |
ipv4From(CharSequence cs)
Creates an Inet4Address from the given CharSequence.
|
static Inet6Address |
ipv6From(CharSequence cs)
Creates an Inet6Address from the given CharSequence.
|
static boolean |
isIpAddress(CharSequence address)
Checks if the given CharSequence represents a valid IP address (IPv4 or IPv6).
|
static boolean |
isIpV4Address(CharSequence address)
Checks if the given CharSequence represents a valid IPv4 address.
|
static boolean |
isIpV6Address(CharSequence address)
Checks if the given CharSequence represents a valid IPv6 address.
|
static DnsName |
reverseIpAddressOf(Inet4Address inet4Address)
Creates the reverse DNS name for the given IPv4 address.
|
static DnsName |
reverseIpAddressOf(Inet6Address inet6Address)
Creates the reverse DNS name for the given IPv6 address.
|
public static InetAddress convertToInetAddressIfPossible(CharSequence address)
address - the CharSequence to convertpublic static Inet4Address ipv4From(CharSequence cs)
cs - the CharSequence containing the IPv4 addressIllegalArgumentException - if the input is not a valid IPv4 addresspublic static Inet6Address ipv6From(CharSequence cs)
cs - the CharSequence containing the IPv6 addressIllegalArgumentException - if the input is not a valid IPv6 addresspublic static boolean isIpAddress(CharSequence address)
address - the CharSequence to validatepublic static boolean isIpV4Address(CharSequence address)
address - the CharSequence to validatepublic static boolean isIpV6Address(CharSequence address)
address - the CharSequence to validatepublic static DnsName reverseIpAddressOf(Inet4Address inet4Address)
inet4Address - the IPv4 addresspublic static DnsName reverseIpAddressOf(Inet6Address inet6Address)
inet6Address - the IPv6 address