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

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

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

Address.truncate介绍

暂无

代码示例

代码示例来源:origin: dnsjava/dnsjava

/**
 * Construct a Client Subnet option.  Note that the number of significant bits
 * in the address must not be greater than the supplied source netmask.  There
 * may also be issues related to Java's handling of mapped addresses
 * @param sourceNetmask The length of the netmask pertaining to the query.
 * In replies, it mirrors the same value as in the requests.
 * @param scopeNetmask The length of the netmask pertaining to the reply.
 * In requests, it MUST be set to 0.  In responses, this may or may not match
 * the source netmask.
 * @param address The address of the client.
 */
public 
ClientSubnetOption(int sourceNetmask, int scopeNetmask, InetAddress address) {
  super(EDNSOption.Code.CLIENT_SUBNET);

  this.family = Address.familyOf(address);
  this.sourceNetmask = checkMaskLength("source netmask", this.family,
             sourceNetmask);
  this.scopeNetmask = checkMaskLength("scope netmask", this.family,
             scopeNetmask);
  this.address = Address.truncate(address, sourceNetmask);

  if (!address.equals(this.address))
    throw new IllegalArgumentException("source netmask is not " +
              "valid for address");
}

代码示例来源:origin: tiandawu/IotXmpp

/**
 * Construct a Client Subnet option.  Note that the number of significant bits in
 * the address must not be greater than the supplied source netmask.
 * XXX something about Java's mapped addresses
 * @param sourceNetmask The length of the netmask pertaining to the query.
 * In replies, it mirrors the same value as in the requests.
 * @param scopeNetmask The length of the netmask pertaining to the reply.
 * In requests, it MUST be set to 0.  In responses, this may or may not match
 * the source netmask.
 * @param address The address of the client.
 */
public 
ClientSubnetOption(int sourceNetmask, int scopeNetmask, InetAddress address) {
  super(Code.CLIENT_SUBNET);

  this.family = Address.familyOf(address);
  this.sourceNetmask = checkMaskLength("source netmask", this.family,
             sourceNetmask);
  this.scopeNetmask = checkMaskLength("scope netmask", this.family,
             scopeNetmask);
  this.address = Address.truncate(address, sourceNetmask);

  if (!address.equals(this.address))
    throw new IllegalArgumentException("source netmask is not " +
              "valid for address");
}

代码示例来源:origin: org.littleshoot/dnsjava

/**
 * Construct a Client Subnet option.  Note that the number of significant bits in
 * the address must not be greater than the supplied source netmask.
 * XXX something about Java's mapped addresses
 * @param sourceNetmask The length of the netmask pertaining to the query.
 * In replies, it mirrors the same value as in the requests.
 * @param scopeNetmask The length of the netmask pertaining to the reply.
 * In requests, it MUST be set to 0.  In responses, this may or may not match
 * the source netmask.
 * @param address The address of the client.
 */
public 
ClientSubnetOption(int sourceNetmask, int scopeNetmask, InetAddress address) {
  super(EDNSOption.Code.CLIENT_SUBNET);

  this.family = Address.familyOf(address);
  this.sourceNetmask = checkMaskLength("source netmask", this.family,
             sourceNetmask);
  this.scopeNetmask = checkMaskLength("scope netmask", this.family,
             scopeNetmask);
  this.address = Address.truncate(address, sourceNetmask);

  if (!address.equals(this.address))
    throw new IllegalArgumentException("source netmask is not " +
              "valid for address");
}

代码示例来源:origin: tiandawu/IotXmpp

InetAddress tmp = Address.truncate(address, sourceNetmask);
if (!tmp.equals(address))
  throw new WireParseException("invalid padding");

代码示例来源:origin: dnsjava/dnsjava

InetAddress tmp = Address.truncate(address, sourceNetmask);
if (!tmp.equals(address))
  throw new WireParseException("invalid padding");

代码示例来源:origin: org.littleshoot/dnsjava

InetAddress tmp = Address.truncate(address, sourceNetmask);
if (!tmp.equals(address))
  throw new WireParseException("invalid padding");

相关文章