java.lang.Object
org.apache.fineract.infrastructure.reportmailingjob.helper.IPv4Helper

public final class IPv4Helper extends Object
This utility provides methods to either convert an IPv4 address to its long format or a 32bit dotted format.
  • Method Details

    • ipAddressToLong

      public static long ipAddressToLong(String ipAddress)
    • longToIpAddress

      public static String longToIpAddress(long ip)
      Returns the 32bit dotted format of the provided long ip.
      Parameters:
      ip - the long ip
      Returns:
      the 32bit dotted format of ip
      Throws:
      IllegalArgumentException - if ip is invalid
    • ipAddressIsInRange

      public static boolean ipAddressIsInRange(String ipAddress, String startOfRange, String endOfRange)
      check if an IP Address is within a given range of IP Addresses
      Parameters:
      ipAddress - -- the IP Address to be checked
      startOfRange - -- the first IP address in the range
      endOfRange - -- the last IP address in the range
      Returns:
      boolean true if IP address is in the range of IP addresses
    • applicationIsRunningOnLocalMachine

      public static boolean applicationIsRunningOnLocalMachine()
      check if the java application is running on a local machine
      Returns:
      true if the application is running on a local machine else false
    • applicationIsNotRunningOnLocalMachine

      public static boolean applicationIsNotRunningOnLocalMachine()
      check if the java application is not running on a local machine
      Returns:
      true if the application is not running on a local machine else false