Package com.isode.dsapi.syntax
Class GenericAddress
java.lang.Object
com.isode.dsapi.syntax.GenericAddress
This class stores utilities for validating an address containing a host name
& port.
- Since:
- 15.0
- Author:
- mv
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidChecks if the currently given address is an IP address.static booleanChecks if the currently given IP address is an IPv4 address.static booleanChecks if the currently given address is an IPv6 address.static StringgetCanonicalHost(String host) The host name is converted to lower case.static voidvalidateAbsolutePort(int port) This function checks if the given integer is a valid short integer and does not contain -1.static voidvalidateHost(String host) This function checks if the given host name is valid.static voidvalidateHostAccessible(String host) This function checks if the given host name is accessible.static voidvalidatePort(int port) This function checks if the given integer is a valid port.
-
Constructor Details
-
GenericAddress
public GenericAddress()
-
-
Method Details
-
validateAbsolutePort
This function checks if the given integer is a valid short integer and does not contain -1.- Parameters:
port- The integer value to check.- Throws:
BadValueException- if the given input is not a valid port.
-
validatePort
This function checks if the given integer is a valid port. -1 is considered valid.- Parameters:
port- The integer value to check.- Throws:
BadValueException- if the given input is not a valid port.
-
validateHost
This function checks if the given host name is valid.- Parameters:
host- The string to check.- Throws:
BadValueException- if the given string is not a valid host.
-
validateHostAccessible
This function checks if the given host name is accessible.- Parameters:
host- The host name to check.- Throws:
BadValueException- if the given host name is accessible.
-
checkIPv4
Checks if the currently given IP address is an IPv4 address.- Parameters:
ip- The IP address to check, must not be null- Returns:
- TRUE if the IP address is an IPv4 address, FALSE otherwise.
-
checkIPv6
Checks if the currently given address is an IPv6 address.- Parameters:
address- The address to check, must not be null.- Returns:
- TRUE if the address is an IPv6 address, FALSE otherwise.
-
checkIP
Checks if the currently given address is an IP address.- Parameters:
address- The address to check, must not be null.- Throws:
BadValueException- if the address is not an IP address.
-
getCanonicalHost
The host name is converted to lower case.- Parameters:
host- Host to convert- Returns:
- canonical form of host.
-