public URIName(String name) throws IOException {
  try {
    uri=new URI(name);
  }
 catch (  URISyntaxException use) {
    throw new IOException("invalid URI name:" + name,use);
  }
  if (uri.getScheme() == null) {
    throw new IOException("URI name must include scheme:" + name);
  }
  host=uri.getHost();
  if (host != null) {
    if (host.charAt(0) == '[') {
      String ipV6Host=host.substring(1,host.length() - 1);
      try {
        hostIP=new IPAddressName(ipV6Host);
      }
 catch (      IOException ioe) {
        throw new IOException("invalid URI name (host " + "portion is not a valid IPv6 address):" + name);
      }
    }
 else {
      try {
        hostDNS=new DNSName(host);
      }
 catch (      IOException ioe) {
        try {
          hostIP=new IPAddressName(host);
        }
 catch (        Exception ioe2) {
          throw new IOException("invalid URI name (host " + "portion is not a valid DNS name, IPv4 address," + " or IPv6 address):"+ name);
        }
      }
    }
  }
}

public URIName ( String name ) throws IOException { try { uri = new URI ( name ) ; } catch ( URISyntaxException use ) { throw new IOException ( "invalid URI name:" + name , use ) ; } if ( uri . getScheme ( ) == null ) { throw new IOException ( "URI name must include scheme:" + name ) ; } host = uri . getHost ( ) ; if ( host != null ) { if ( host . charAt ( 0 ) == '[' ) { String ipV6Host = host . substring ( 1 , host . length ( ) - 1 ) ; try { hostIP = new IPAddressName ( ipV6Host ) ; } catch ( IOException ioe ) { throw new IOException ( "invalid URI name (host " + "portion is not a valid IPv6 address):" + name ) ; } } else { try { hostDNS = new DNSName ( host ) ; } catch ( IOException ioe ) { try { hostIP = new IPAddressName ( host ) ; } catch ( Exception ioe2 ) { throw new IOException ( "invalid URI name (host " + "portion is not a valid DNS name, IPv4 address," + " or IPv6 address):" + name ) ; } } } } }
create the uriname object with the specified name .
