Package io.odilon.client.util
Class InetAddressValidator
java.lang.Object
io.odilon.client.util.InetAddressValidator
- All Implemented Interfaces:
Serializable
InetAddress validation and conversion routines (java.net.InetAddress
).
This class provides methods to validate a candidate IP address.
This class is a Singleton; you can retrieve the instance via the getInstance()
method.
- Author:
- atolomei@novamens.com (Alejandro Tolomei)
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic InetAddressValidator
Returns the singleton instance of this validator.boolean
Checks if the specified string is a valid IP address.boolean
isValidInet4Address
(String inet4Address) Validates an IPv4 address.boolean
isValidInet6Address
(String inet6Address) Validates an IPv6 address.
-
Constructor Details
-
InetAddressValidator
public InetAddressValidator()
-
-
Method Details
-
getInstance
Returns the singleton instance of this validator.- Returns:
- the singleton instance of this validator
-
isValid
Checks if the specified string is a valid IP address.- Parameters:
inetAddress
- the string to validate- Returns:
- true if the string validates as an IP address
-
isValidInet4Address
Validates an IPv4 address. Returns true if valid.- Parameters:
inet4Address
- the IPv4 address to validate- Returns:
- true if the argument contains a valid IPv4 address
-
isValidInet6Address
Validates an IPv6 address. Returns true if valid.- Parameters:
inet6Address
- the IPv6 address to validate- Returns:
- true if the argument contains a valid IPv6 address
- Since:
- 1.4.1
-