Package org.eblocker.server.common.util
Class Ip4Utils
java.lang.Object
org.eblocker.server.common.util.Ip4Utils
Utility functions for IPv4 addresses.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intconvertBytesToIp(byte[] bytes) static intconvertCidrToNetMask(int cidr) static StringconvertIpIntToString(int ip) static int[]convertIpRangeToIpNetmask(String ipRange) static intstatic byte[]convertIpToBytes(int ip) static intstatic intconvertNetMaskToCidr(int netMask) static Stringstatic booleanisInSubnet(int ip, int subnet, int netmask) static booleanisInSubnet(String ip, String subnet, String netmask) static booleanisIPAddress(String ipaddress) Returns true if the given string is an IPv4 address.static booleanstatic booleanisLinkLocal(Ip4Address ip4Address) static booleanisPrivate(Ip4Address ip4Address)
-
Constructor Details
-
Ip4Utils
public Ip4Utils()
-
-
Method Details
-
isIPAddress
Returns true if the given string is an IPv4 address.- Parameters:
ipaddress- IP address as string- Returns:
- true if ipaddress is an IPv4 address
-
isIpRange
-
getSubnet
-
convertIpStringToInt
-
convertIpIntToString
-
convertNetMaskToCidr
public static int convertNetMaskToCidr(int netMask) -
convertCidrToNetMask
public static int convertCidrToNetMask(int cidr) -
isInSubnet
-
isInSubnet
public static boolean isInSubnet(int ip, int subnet, int netmask) -
convertIpRangeToIpNetmask
-
convertIpToBytes
public static byte[] convertIpToBytes(int ip) -
convertBytesToIp
public static int convertBytesToIp(byte[] bytes) -
convertIpToInt
-
isLinkLocal
-
isPrivate
-