Class IPv4Helper
java.lang.Object
org.apache.fineract.infrastructure.reportmailingjob.helper.IPv4Helper
This utility provides methods to either convert an IPv4 address to its long format or a 32bit dotted format.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheck if the java application is not running on a local machinestatic booleancheck if the java application is running on a local machinestatic booleanipAddressIsInRange(String ipAddress, String startOfRange, String endOfRange) check if an IP Address is within a given range of IP Addressesstatic longipAddressToLong(String ipAddress) static StringlongToIpAddress(long ip) Returns the 32bit dotted format of the provided long ip.
-
Method Details
-
ipAddressToLong
-
longToIpAddress
Returns the 32bit dotted format of the provided long ip.- Parameters:
ip- the long ip- Returns:
- the 32bit dotted format of
ip - Throws:
IllegalArgumentException- ifipis invalid
-
ipAddressIsInRange
check if an IP Address is within a given range of IP Addresses- Parameters:
ipAddress- -- the IP Address to be checkedstartOfRange- -- the first IP address in the rangeendOfRange- -- 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
-