本文整理了Java中org.xbill.DNS.Address.lookupHostName()
方法的一些代码示例,展示了Address.lookupHostName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Address.lookupHostName()
方法的具体详情如下:
包路径:org.xbill.DNS.Address
类名称:Address
方法名:lookupHostName
暂无
代码示例来源:origin: org.littleshoot/dnsjava
/**
* Determines the IP address of a host
* @param name The hostname to look up
* @return The first matching IP address
* @exception UnknownHostException The hostname does not have any addresses
*/
public static InetAddress
getByName(String name) throws UnknownHostException {
try {
return getByAddress(name);
} catch (UnknownHostException e) {
Record [] records = lookupHostName(name);
return addrFromRecord(name, records[0]);
}
}
代码示例来源:origin: dnsjava/dnsjava
/**
* Determines the IP address of a host
* @param name The hostname to look up
* @return The first matching IP address
* @exception UnknownHostException The hostname does not have any addresses
*/
public static InetAddress
getByName(String name) throws UnknownHostException {
try {
return getByAddress(name);
} catch (UnknownHostException e) {
Record [] records = lookupHostName(name, false);
return addrFromRecord(name, records[0]);
}
}
代码示例来源:origin: net.sf.dnsjava-osgi/dnsjava-osgi
/**
* Determines the IP address of a host
* @param name The hostname to look up
* @return The first matching IP address
* @exception UnknownHostException The hostname does not have any addresses
*/
public static InetAddress
getByName(String name) throws UnknownHostException {
try {
return getByAddress(name);
} catch (UnknownHostException e) {
Record [] records = lookupHostName(name);
return addrFromRecord(name, records[0]);
}
}
代码示例来源:origin: tiandawu/IotXmpp
/**
* Determines the IP address of a host
* @param name The hostname to look up
* @return The first matching IP address
* @exception UnknownHostException The hostname does not have any addresses
*/
public static InetAddress
getByName(String name) throws UnknownHostException {
try {
return getByAddress(name);
} catch (UnknownHostException e) {
Record [] records = lookupHostName(name);
return addrFromRecord(name, records[0]);
}
}
代码示例来源:origin: dnsjava/dnsjava
/**
* Determines all IP address of a host
* @param name The hostname to look up
* @return All matching IP addresses
* @exception UnknownHostException The hostname does not have any addresses
*/
public static InetAddress []
getAllByName(String name) throws UnknownHostException {
try {
InetAddress addr = getByAddress(name);
return new InetAddress[] {addr};
} catch (UnknownHostException e) {
Record [] records = lookupHostName(name, true);
InetAddress [] addrs = new InetAddress[records.length];
for (int i = 0; i < records.length; i++)
addrs[i] = addrFromRecord(name, records[i]);
return addrs;
}
}
代码示例来源:origin: net.sf.dnsjava-osgi/dnsjava-osgi
/**
* Determines all IP address of a host
* @param name The hostname to look up
* @return All matching IP addresses
* @exception UnknownHostException The hostname does not have any addresses
*/
public static InetAddress []
getAllByName(String name) throws UnknownHostException {
try {
InetAddress addr = getByAddress(name);
return new InetAddress[] {addr};
} catch (UnknownHostException e) {
Record [] records = lookupHostName(name);
InetAddress [] addrs = new InetAddress[records.length];
for (int i = 0; i < records.length; i++)
addrs[i] = addrFromRecord(name, records[i]);
return addrs;
}
}
代码示例来源:origin: org.littleshoot/dnsjava
/**
* Determines all IP address of a host
* @param name The hostname to look up
* @return All matching IP addresses
* @exception UnknownHostException The hostname does not have any addresses
*/
public static InetAddress []
getAllByName(String name) throws UnknownHostException {
try {
InetAddress addr = getByAddress(name);
return new InetAddress[] {addr};
} catch (UnknownHostException e) {
Record [] records = lookupHostName(name);
InetAddress [] addrs = new InetAddress[records.length];
for (int i = 0; i < records.length; i++)
addrs[i] = addrFromRecord(name, records[i]);
return addrs;
}
}
代码示例来源:origin: tiandawu/IotXmpp
/**
* Determines all IP address of a host
* @param name The hostname to look up
* @return All matching IP addresses
* @exception UnknownHostException The hostname does not have any addresses
*/
public static InetAddress []
getAllByName(String name) throws UnknownHostException {
try {
InetAddress addr = getByAddress(name);
return new InetAddress[] {addr};
} catch (UnknownHostException e) {
Record [] records = lookupHostName(name);
InetAddress [] addrs = new InetAddress[records.length];
for (int i = 0; i < records.length; i++)
addrs[i] = addrFromRecord(name, records[i]);
return addrs;
}
}
内容来源于网络,如有侵权,请联系作者删除!