src/main/java/org/owasp/url/AuthorityClassifierBuilder.java
public AuthorityClassifierBuilder host(String... hosts) {
    for (String host : hosts) {
      int len = host.length();
      Preconditions.checkArgument(len > 0, "Empty string passed as hostname");
      if (InetAddresses.isUriInetAddress(host)) {
        InetAddress addr = InetAddresses.forUriString(host);
        if (addr instanceof Inet6Address) {
          ipv6s.add((Inet6Address) addr);
        } else {
          ipv4s.add((Inet4Address) addr);
        }
      } else {
        IDNA.Info info = new IDNA.Info();
        domainNames.add(Authority.toDomainName(host, info));
        Preconditions.checkArgument(
            !info.hasErrors(), "Invalid domain name", host, info.getErrors());
      }
    }
    return this;
  }
/**
   * Accepts hostnames or numeric IPAs.
   * IPv6 addresses should be in square brackets.
   */
Accepts hostnames or numeric IPAs.
IPv6 addresses should be in square brackets.
Accepts hostnames or numeric IPAs . IPv6 addresses should be in square brackets .
public AuthorityClassifierBuilder host(String... hosts) {
    for (String host : hosts) {
      int len = host.length();
      Preconditions.checkArgument(len > 0, "Empty string passed as hostname");
      if (InetAddresses.isUriInetAddress(host)) {
        InetAddress addr = InetAddresses.forUriString(host);
        if (addr instanceof Inet6Address) {
          ipv6s.add((Inet6Address) addr);
        } else {
          ipv4s.add((Inet4Address) addr);
        }
      } else {
        IDNA.Info info = new IDNA.Info();
        domainNames.add(Authority.toDomainName(host, info));
        Preconditions.checkArgument(
            !info.hasErrors(), "Invalid domain name", host, info.getErrors());
      }
    }
    return this;
  }
public AuthorityClassifierBuilder host ( String ... hosts ) { for ( String host : hosts ) { int len = host . length ( ) ; Preconditions . checkArgument ( len > 0 , "Empty string passed as hostname" ) ; if ( InetAddresses . isUriInetAddress ( host ) ) { InetAddress addr = InetAddresses . forUriString ( host ) ; if ( addr instanceof Inet6Address ) { ipv6s . add ( ( Inet6Address ) addr ) ; } else { ipv4s . add ( ( Inet4Address ) addr ) ; } } else { IDNA . Info info = new IDNA . Info ( ) ; domainNames . add ( Authority . toDomainName ( host , info ) ) ; Preconditions . checkArgument ( ! info . hasErrors ( ) , "Invalid domain name" , host , info . getErrors ( ) ) ; } } return this ; }
Accepts hostnames or numeric IPAs.
Accepts hostnames or numeric IPAs .