org.xbill.DNS.Address.addrFromRecord()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中org.xbill.DNS.Address.addrFromRecord()方法的一些代码示例,展示了Address.addrFromRecord()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Address.addrFromRecord()方法的具体详情如下:
包路径:org.xbill.DNS.Address
类名称:Address
方法名:addrFromRecord

Address.addrFromRecord介绍

暂无

代码示例

代码示例来源: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;
  }
}

相关文章