@Ignore @Test public void testResolve() throws Exception { System.out.println(NetUtil.resolveDottedIP("addthis.com")); System.out.println(NetUtil.resolveDottedIP("209.61.188.91")); }
public static String resolveDottedIP(String ip) { if (ip.length() == 0 || !(Character.isDigit(ip.charAt(ip.length() - 1)) && Character.isDigit(ip.charAt(0)))) { return ip; } try { String newhost = InetAddress.getByName(ip).getHostName(); if (newhost != null) { return newhost; } } catch (Exception ex) { } return ip; }
NetUtil { public static String resolveDottedIP(String ip) { if (ip.length() == 0 || !(Character.isDigit(ip.charAt(ip.length() - 1)) && Character.isDigit(ip.charAt(0)))) { return ip; } try { String newhost = InetAddress.getByName(ip).getHostName(); if (newhost != null) { return newhost; } } catch (Exception ex) { } return ip; } }
NetUtil { public static String resolveDottedIP(String ip) { if (ip.length() == 0 || !(Character.isDigit(ip.charAt(ip.length() - 1)) && Character.isDigit(ip.charAt(0)))) { return ip; } try { String newhost = InetAddress.getByName(ip).getHostName(); if (newhost != null) { return newhost; } } catch (Exception ex) { } return ip; }  }
NetUtil { public static String resolveDottedIP(String ip) { if (ip.length() == 0 || !(Character.isDigit(ip.charAt(ip.length() - 1)) && Character.isDigit(ip.charAt(0)))) { return ip; } try { String newhost = InetAddress.getByName(ip).getHostName(); if (newhost != null) { return newhost; } } catch (Exception ex) { } return ip; }  static Host parseHost(String str); static Host parseHost(String str, int defaultPort); static List<Host> parseHostList(String str); static boolean hostNameMatch(String hostname, List<Host> list); static boolean hostNameMatch(InetAddress host, List<Host> list); static byte[] getInetAddressAsHex(InetAddress addr); static InetAddress getInetAddressFromHex(String hex); static String inferDomain(); static String getBaseDomain(String host); static String getBaseDomain(String host, boolean tight); static String resolveDottedIP(String ip); static long ipToLong(String ip); static String longToIp(long i); }
NetUtil { public static String resolveDottedIP(String ip) { if (ip.length() == 0 || !(Character.isDigit(ip.charAt(ip.length() - 1)) && Character.isDigit(ip.charAt(0)))) { return ip; } try { String newhost = InetAddress.getByName(ip).getHostName(); if (newhost != null) { return newhost; } } catch (Exception ex) { } return ip; }  static Host parseHost(String str); static Host parseHost(String str, int defaultPort); static List<Host> parseHostList(String str); static boolean hostNameMatch(String hostname, List<Host> list); static boolean hostNameMatch(InetAddress host, List<Host> list); static byte[] getInetAddressAsHex(InetAddress addr); static InetAddress getInetAddressFromHex(String hex); static String inferDomain(); static String getBaseDomain(String host); static String getBaseDomain(String host, boolean tight); static String resolveDottedIP(String ip); static long ipToLong(String ip); static String longToIp(long i); static final byte hex; }