public static URI parseURI(String nuri,URI baseuri) throws URISyntaxException {
  int colonLocation=nuri.indexOf(':');
  int fragmentLocation=getFragmentLocation(nuri);
  if (colonLocation == -1 || colonLocation > fragmentLocation) {
    if (baseuri == null)     throw new URISyntaxException("No ':' in \"" + nuri + "\" and no base URI given,"+ " so no relative URIs allowed",nuri);
  }
  String protocol=nuri.substring(0,colonLocation);
  if (protocol.equals("urn")) {
    return parseURN(nuri,colonLocation,fragmentLocation);
  }
 else   if (protocol.equals("http")) {
    return new URI(nuri);
  }
 else   if (protocol.equals("file")) {
    return new URI(nuri);
  }
 else   if (protocol.equals("res")) {
    return new URI(nuri);
  }
 else {
    return parseGeneralURI(nuri,colonLocation,fragmentLocation);
  }
}

public static URI parseURI ( String nuri , URI baseuri ) throws URISyntaxException { int colonLocation = nuri . indexOf ( ':' ) ; int fragmentLocation = getFragmentLocation ( nuri ) ; if ( colonLocation == - 1 || colonLocation > fragmentLocation ) { if ( baseuri == null ) throw new URISyntaxException ( "No ':' in \"" + nuri + "\" and no base URI given," + " so no relative URIs allowed" , nuri ) ; } String protocol = nuri . substring ( 0 , colonLocation ) ; if ( protocol . equals ( "urn" ) ) { return parseURN ( nuri , colonLocation , fragmentLocation ) ; } else if ( protocol . equals ( "http" ) ) { return new URI ( nuri ) ; } else if ( protocol . equals ( "file" ) ) { return new URI ( nuri ) ; } else if ( protocol . equals ( "res" ) ) { return new URI ( nuri ) ; } else { return parseGeneralURI ( nuri , colonLocation , fragmentLocation ) ; } }
constructs an uri from a string
