Back to project page android-sdk.
The source code is released under:
MIT License
If you think the Android project android-sdk listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.qiniu.android.utils; //w ww.ja va 2 s. co m import java.net.InetAddress; import java.net.UnknownHostException; /** * Dns???? */ public final class Dns { public static String[] getAddresses(String hostName){ InetAddress[] ret = null; try { ret = InetAddress.getAllByName(hostName); } catch (UnknownHostException e) { e.printStackTrace(); return new String[0]; } String[] r = new String[ret.length]; for (int i = 0; i < r.length; i++) { r[i] = ret[i].getHostAddress(); } return r; } public static String getAddressesString(String hostName){ return StringUtils.join(getAddresses(hostName), ";"); } }