Class GenericAddress

java.lang.Object
com.isode.dsapi.syntax.GenericAddress

public class GenericAddress extends Object
This class stores utilities for validating an address containing a host name & port.
Since:
15.0
Author:
mv
  • Constructor Details

    • GenericAddress

      public GenericAddress()
  • Method Details

    • validateAbsolutePort

      public static void validateAbsolutePort(int port) throws BadValueException
      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

      public static void validatePort(int port) throws BadValueException
      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

      public static void validateHost(String host) throws BadValueException
      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

      public static void validateHostAccessible(String host) throws BadValueException
      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

      public static boolean checkIPv4(String ip)
      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

      public static boolean checkIPv6(String address)
      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

      public static void checkIP(String address) throws BadValueException
      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

      public static String getCanonicalHost(String host)
      The host name is converted to lower case.
      Parameters:
      host - Host to convert
      Returns:
      canonical form of host.