@Test public void testgetIpVersionOfIp() { assertEquals(IpVersion.V4, IpUtil.getIpVersionOfIp("13.23.45.67")); assertEquals(IpVersion.V4, IpUtil.getIpVersionOfIp("0.0.0.0")); assertEquals(IpVersion.V4, IpUtil.getIpVersionOfIp("255.255.255.255")); assertEquals(IpVersion.INVALID, IpUtil.getIpVersionOfIp("1:255.255.255")); assertEquals(IpVersion.V6, IpUtil.getIpVersionOfIp("::")); assertEquals(IpVersion.INVALID, IpUtil.getIpVersionOfIp("*.2.255.255")); }
public static IpVersion getIpVersionOfIp(String ipPrefix) { if (StringUtils.isBlank(ipPrefix)) { return IpVersion.INVALID; } if (StringUtils.contains(ipPrefix, "/")) { return IpVersion.INVALID; } IpVersion ipVersion = getIpVersionOfNetwork(ipPrefix); return ipVersion; }
IpUtil { public static IpVersion getIpVersionOfIp(String ipPrefix) { if (StringUtils.isBlank(ipPrefix)) { return IpVersion.INVALID; } if (StringUtils.contains(ipPrefix, "/")) { return IpVersion.INVALID; } IpVersion ipVersion = getIpVersionOfNetwork(ipPrefix); return ipVersion; } }
IpUtil { public static IpVersion getIpVersionOfIp(String ipPrefix) { if (StringUtils.isBlank(ipPrefix)) { return IpVersion.INVALID; } if (StringUtils.contains(ipPrefix, "/")) { return IpVersion.INVALID; } IpVersion ipVersion = getIpVersionOfNetwork(ipPrefix); return ipVersion; } private  IpUtil(); }
IpUtil { public static IpVersion getIpVersionOfIp(String ipPrefix) { if (StringUtils.isBlank(ipPrefix)) { return IpVersion.INVALID; } if (StringUtils.contains(ipPrefix, "/")) { return IpVersion.INVALID; } IpVersion ipVersion = getIpVersionOfNetwork(ipPrefix); return ipVersion; } private  IpUtil(); static IpInBytes parseIp(String ip, IpVersion ipVersion); static int getHexCharSize(IpVersion ipVersion); static IpVersion getIpVersionOfNetwork(String cidr); static NetworkInBytes parseNetwork(String cidr, IpVersion ipVersion); static NetworkInBytes parseNetworkV6(String cidr); static NetworkInBytes parseNetworkV4(String cidr); static byte[] ipToByteArray(String ipPrefix, IpVersion ipVersion); static byte[] ipToByteArray(String ipPrefix); static IpVersion getIpVersionOfIp(String ipPrefix); static String toString(byte[] bytes, IpVersion ipVersion); static String addNetworkMaskIfNotContainsMask(String cidr); static String generateNetworkRangeSql(String ipColumnName,
            String ipVersionColumnName); static String generateNetworkVersionSql(String ipVersionColumnName); }
IpUtil { public static IpVersion getIpVersionOfIp(String ipPrefix) { if (StringUtils.isBlank(ipPrefix)) { return IpVersion.INVALID; } if (StringUtils.contains(ipPrefix, "/")) { return IpVersion.INVALID; } IpVersion ipVersion = getIpVersionOfNetwork(ipPrefix); return ipVersion; } private  IpUtil(); static IpInBytes parseIp(String ip, IpVersion ipVersion); static int getHexCharSize(IpVersion ipVersion); static IpVersion getIpVersionOfNetwork(String cidr); static NetworkInBytes parseNetwork(String cidr, IpVersion ipVersion); static NetworkInBytes parseNetworkV6(String cidr); static NetworkInBytes parseNetworkV4(String cidr); static byte[] ipToByteArray(String ipPrefix, IpVersion ipVersion); static byte[] ipToByteArray(String ipPrefix); static IpVersion getIpVersionOfIp(String ipPrefix); static String toString(byte[] bytes, IpVersion ipVersion); static String addNetworkMaskIfNotContainsMask(String cidr); static String generateNetworkRangeSql(String ipColumnName,
            String ipVersionColumnName); static String generateNetworkVersionSql(String ipVersionColumnName); static final int RADIX_HEX; static final int RADIX_DECIMAL; }