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

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

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

Address.familyOf介绍

暂无

代码示例

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

/**
 * Creates an APL element corresponding to an IPv4 or IPv6 prefix.
 * @param negative Indicates if this prefix is a negation.
 * @param address The IPv4 or IPv6 address.
 * @param prefixLength The length of this prefix, in bits.
 * @throws IllegalArgumentException The prefix length is invalid.
 */
public
Element(boolean negative, InetAddress address, int prefixLength) {
  this(Address.familyOf(address), negative, address,
     prefixLength);
}

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

/**
 * Creates an APL element corresponding to an IPv4 or IPv6 prefix.
 * @param negative Indicates if this prefix is a negation.
 * @param address The IPv4 or IPv6 address.
 * @param prefixLength The length of this prefix, in bits.
 * @throws IllegalArgumentException The prefix length is invalid.
 */
public
Element(boolean negative, InetAddress address, int prefixLength) {
  this(Address.familyOf(address), negative, address,
     prefixLength);
}

代码示例来源:origin: net.sf.dnsjava-osgi/dnsjava-osgi

/**
 * Creates an APL element corresponding to an IPv4 or IPv6 prefix.
 * @param negative Indicates if this prefix is a negation.
 * @param address The IPv4 or IPv6 address.
 * @param prefixLength The length of this prefix, in bits.
 * @throws IllegalArgumentException The prefix length is invalid.
 */
public
Element(boolean negative, InetAddress address, int prefixLength) {
  this(Address.familyOf(address), negative, address,
     prefixLength);
}

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

/**
 * Creates an APL element corresponding to an IPv4 or IPv6 prefix.
 * @param negative Indicates if this prefix is a negation.
 * @param address The IPv4 or IPv6 address.
 * @param prefixLength The length of this prefix, in bits.
 * @throws IllegalArgumentException The prefix length is invalid.
 */
public
Element(boolean negative, InetAddress address, int prefixLength) {
  this(Address.familyOf(address), negative, address,
     prefixLength);
}

代码示例来源:origin: net.sf.dnsjava-osgi/dnsjava-osgi

/**
 * Creates an AAAA Record from the given data
 * @param address The address suffix
 */
public
AAAARecord(Name name, int dclass, long ttl, InetAddress address) {
  super(name, Type.AAAA, dclass, ttl);
  if (Address.familyOf(address) != Address.IPv6)
    throw new IllegalArgumentException("invalid IPv6 address");
  this.address = address;
}

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

/**
 * Creates an AAAA Record from the given data
 * @param address The address suffix
 */
public
AAAARecord(Name name, int dclass, long ttl, InetAddress address) {
  super(name, Type.AAAA, dclass, ttl);
  if (Address.familyOf(address) != Address.IPv6)
    throw new IllegalArgumentException("invalid IPv6 address");
  this.address = address;
}

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

/**
 * Creates an AAAA Record from the given data
 * @param address The address suffix
 */
public
AAAARecord(Name name, int dclass, long ttl, InetAddress address) {
  super(name, Type.AAAA, dclass, ttl);
  if (Address.familyOf(address) != Address.IPv6)
    throw new IllegalArgumentException("invalid IPv6 address");
  this.address = address;
}

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

/**
 * Creates an AAAA Record from the given data
 * @param address The address suffix
 */
public
AAAARecord(Name name, int dclass, long ttl, InetAddress address) {
  super(name, Type.AAAA, dclass, ttl);
  if (Address.familyOf(address) != Address.IPv6)
    throw new IllegalArgumentException("invalid IPv6 address");
  this.address = address.getAddress();
}

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

/**
 * Creates an A Record from the given data
 * @param address The address that the name refers to
 */
public
ARecord(Name name, int dclass, long ttl, InetAddress address) {
  super(name, Type.A, dclass, ttl);
  if (Address.familyOf(address) != Address.IPv4)
    throw new IllegalArgumentException("invalid IPv4 address");
  addr = fromArray(address.getAddress());
}

代码示例来源:origin: net.sf.dnsjava-osgi/dnsjava-osgi

/**
 * Creates an A Record from the given data
 * @param address The address that the name refers to
 */
public
ARecord(Name name, int dclass, long ttl, InetAddress address) {
  super(name, Type.A, dclass, ttl);
  if (Address.familyOf(address) != Address.IPv4)
    throw new IllegalArgumentException("invalid IPv4 address");
  addr = fromArray(address.getAddress());
}

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

/**
 * Creates an A Record from the given data
 * @param address The address that the name refers to
 */
public
ARecord(Name name, int dclass, long ttl, InetAddress address) {
  super(name, Type.A, dclass, ttl);
  if (Address.familyOf(address) != Address.IPv4)
    throw new IllegalArgumentException("invalid IPv4 address");
  addr = fromArray(address.getAddress());
}

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

/**
 * Creates an A Record from the given data
 * @param address The address that the name refers to
 */
public
ARecord(Name name, int dclass, long ttl, InetAddress address) {
  super(name, Type.A, dclass, ttl);
  if (Address.familyOf(address) != Address.IPv4)
    throw new IllegalArgumentException("invalid IPv4 address");
  addr = fromArray(address.getAddress());
}

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

/**
 * Creates a WKS Record from the given data
 * @param address The IP address
 * @param protocol The IP protocol number
 * @param services An array of supported services, represented by port number.
 */
public
WKSRecord(Name name, int dclass, long ttl, InetAddress address, int protocol,
   int [] services)
{
  super(name, Type.WKS, dclass, ttl);
  if (Address.familyOf(address) != Address.IPv4)
    throw new IllegalArgumentException("invalid IPv4 address");
  this.address = address.getAddress();
  this.protocol = checkU8("protocol", protocol);
  for (int i = 0; i < services.length; i++) {
    checkU16("service", services[i]);
  }
  this.services = new int[services.length];
  System.arraycopy(services, 0, this.services, 0, services.length);
  Arrays.sort(this.services);
}

代码示例来源:origin: net.sf.dnsjava-osgi/dnsjava-osgi

/**
 * Creates a WKS Record from the given data
 * @param address The IP address
 * @param protocol The IP protocol number
 * @param services An array of supported services, represented by port number.
 */
public
WKSRecord(Name name, int dclass, long ttl, InetAddress address, int protocol,
   int [] services)
{
  super(name, Type.WKS, dclass, ttl);
  if (Address.familyOf(address) != Address.IPv4)
    throw new IllegalArgumentException("invalid IPv4 address");
  this.address = address.getAddress();
  this.protocol = checkU8("protocol", protocol);
  for (int i = 0; i < services.length; i++) {
    checkU16("service", services[i]);
  }
  this.services = new int[services.length];
  System.arraycopy(services, 0, this.services, 0, services.length);
  Arrays.sort(this.services);
}

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

/**
 * Creates a WKS Record from the given data
 * @param address The IP address
 * @param protocol The IP protocol number
 * @param services An array of supported services, represented by port number.
 */
public
WKSRecord(Name name, int dclass, long ttl, InetAddress address, int protocol,
   int [] services)
{
  super(name, Type.WKS, dclass, ttl);
  if (Address.familyOf(address) != Address.IPv4)
    throw new IllegalArgumentException("invalid IPv4 address");
  this.address = address.getAddress();
  this.protocol = checkU8("protocol", protocol);
  for (int i = 0; i < services.length; i++) {
    checkU16("service", services[i]);
  }
  this.services = new int[services.length];
  System.arraycopy(services, 0, this.services, 0, services.length);
  Arrays.sort(this.services);
}

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

/**
 * Creates an A6 Record from the given data
 * @param prefixBits The number of bits in the address prefix
 * @param suffix The address suffix
 * @param prefix The name of the prefix
 */
public
A6Record(Name name, int dclass, long ttl, int prefixBits,
   InetAddress suffix, Name prefix)
{
  super(name, Type.A6, dclass, ttl);
  this.prefixBits = checkU8("prefixBits", prefixBits);
  if (suffix != null && Address.familyOf(suffix) != Address.IPv6)
    throw new IllegalArgumentException("invalid IPv6 address");
  this.suffix = suffix;
  if (prefix != null)
    this.prefix = checkName("prefix", prefix);
}

代码示例来源:origin: net.sf.dnsjava-osgi/dnsjava-osgi

/**
 * Creates an A6 Record from the given data
 * @param prefixBits The number of bits in the address prefix
 * @param suffix The address suffix
 * @param prefix The name of the prefix
 */
public
A6Record(Name name, int dclass, long ttl, int prefixBits,
   InetAddress suffix, Name prefix)
{
  super(name, Type.A6, dclass, ttl);
  this.prefixBits = checkU8("prefixBits", prefixBits);
  if (suffix != null && Address.familyOf(suffix) != Address.IPv6)
    throw new IllegalArgumentException("invalid IPv6 address");
  this.suffix = suffix;
  if (prefix != null)
    this.prefix = checkName("prefix", prefix);
}

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

/**
 * Creates an A6 Record from the given data
 * @param prefixBits The number of bits in the address prefix
 * @param suffix The address suffix
 * @param prefix The name of the prefix
 */
public
A6Record(Name name, int dclass, long ttl, int prefixBits,
   InetAddress suffix, Name prefix)
{
  super(name, Type.A6, dclass, ttl);
  this.prefixBits = checkU8("prefixBits", prefixBits);
  if (suffix != null && Address.familyOf(suffix) != Address.IPv6)
    throw new IllegalArgumentException("invalid IPv6 address");
  this.suffix = suffix;
  if (prefix != null)
    this.prefix = checkName("prefix", prefix);
}

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

/**
 * Creates an A6 Record from the given data
 * @param prefixBits The number of bits in the address prefix
 * @param suffix The address suffix
 * @param prefix The name of the prefix
 */
public
A6Record(Name name, int dclass, long ttl, int prefixBits,
   InetAddress suffix, Name prefix)
{
  super(name, Type.A6, dclass, ttl);
  this.prefixBits = checkU8("prefixBits", prefixBits);
  if (suffix != null && Address.familyOf(suffix) != Address.IPv6)
    throw new IllegalArgumentException("invalid IPv6 address");
  this.suffix = suffix;
  if (prefix != null)
    this.prefix = checkName("prefix", prefix);
}

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

相关文章