URI e.g. jre:/java.base/java/lang/Object.class
12878
private FileNode moduleFile(URL url) {
        String module;
        int idx;

        module = url.getFile();
        module = Strings.removeLeft(module, "/");
        idx = module.indexOf("/");
        if (idx == -1) {
            throw new RuntimeException("unexpected jre url: " + url);
        }
        module = module.substring(0, idx);
        return file(System.getProperty("java.home")).join("jmods", module + ".jmod");
    }
771375
def select_uri_implementation(ecore_model_path):
    """"""
    if URL_PATTERN.match(ecore_model_path):
        return pyecore.resources.resource.HttpURI
    return pyecore.resources.URI
1242113
function relativeURI(uri, base) {
    
    // reduce base and uri strings to just their difference string
    var baseParts = base.split('/');
    baseParts.pop();
    base = baseParts.join('/') + '/';
    i = 0;
    while (base.substr(i, 1) == uri.substr(i, 1))
      i++;
    while (base.substr(i, 1) != '/')
      i--;
    base = base.substr(i + 1);
    uri = uri.substr(i + 1);

    // each base folder difference is thus a backtrack
    baseParts = base.split('/');
    var uriParts = uri.split('/');
    out = '';
    while (baseParts.shift())
      out += '../';
    
    // finally add uri parts
    while (curPart = uriParts.shift())
      out += curPart + '/';
    
    return out.substr(0, out.length - 1);
  }
326571
function parse_uri(uri = document.location)
{
	const options =
	{
		strictMode: false,
		key:
		[
			"source",   // protocol:
			"protocol",
			"authority", // //user:password@
			"userInfo", // user:password
			"user",
			"password",
			"host",
			"port",
			"relative", 
			"path",
			"directory",
			"file",
			"query",
			"anchor"
		],
		query:
		{
			name:   "parameters",
			parser: /(?:^|&)([^&=]*)=?([^&]*)/g
		},
		parser:
		{
			//            protocol  :     //      user        :password    @  host          :port      path (relative,directory,file) ? query       #anchor
			strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
			loose:  /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
		}
	}
		
	var matches = options.parser[options.strictMode ? "strict" : "loose"].exec(uri)
	
	const result = {}

	let i = 14
	while (i--)
	{
		result[options.key[i]] = matches[i] || ""
	}

	result[options.query.name] = {}

	// options.key[12] === "query"
	result[options.key[12]].replace(options.query.parser, function ($0, $1, $2)
	{
		if ($1)
		{
			result[options.query.name][$1] = $2
		}
	})

	return result
}
545547
private URI buildURI(String path) throws URISyntaxException
   {
      try
      {
         return new URI(path);
      }
      catch (URISyntaxException e)
      {
         return new URI(TextUtil.escape(path, '%', true));
      }
   }
962680
public void setDocumentURI(String arg0) {
	// dynamic load to support jre 1.4 and 1.5
	try {
	    Method m = doc.getClass().getMethod("setDocumentURI", new Class[] { arg0.getClass() });
	    m.invoke(doc, new Object[] { arg0 });
	}
	catch (Exception e) {
	    throw new PageRuntimeException(Caster.toPageException(e));
	}

    }
21076
private URI decodeHarURI(URI rawURI, Configuration conf) throws IOException {
    String tmpAuth = rawURI.getAuthority();
    //we are using the default file
    //system in the config
    //so create a underlying uri and
    //return it
    if (tmpAuth == null) {
      //create a path
      return FileSystem.getDefaultUri(conf);
    }
    String host = rawURI.getHost();
    String[] str = host.split("-", 2);
    if (str[0] == null) {
      throw new IOException("URI: " + rawURI + " is an invalid Har URI.");
    }
    String underLyingScheme = str[0];
    String underLyingHost = (str.length > 1)? str[1]:null;
    int underLyingPort = rawURI.getPort();
    String auth = (underLyingHost == null && underLyingPort == -1)?
                  null:(underLyingHost+":"+underLyingPort);
    URI tmp = null;
    if (rawURI.getQuery() != null) {
      // query component not allowed
      throw new IOException("query component in Path not supported  " + rawURI);
    }
    try {
      tmp = new URI(underLyingScheme, auth, rawURI.getPath(),
            rawURI.getQuery(), rawURI.getFragment());
    } catch (URISyntaxException e) {
        // do nothing should not happen
    }
    return tmp;
  }
5488
public static URI[] downloadJar(String org, String module, String version, boolean transitive) throws IOException {
    Map<String, Object> artifactMap = Maps.newHashMap();
    artifactMap.put("org", org);
    artifactMap.put("module", module);
    artifactMap.put("version", version);
    artifactMap.put("transitive", transitive);
    return downloadJar(artifactMap);
  }
1211430
URI generateUrl(InitializrServiceMetadata metadata) {
		try {
			URIBuilder builder = new URIBuilder(this.serviceUrl);
			StringBuilder sb = new StringBuilder();
			if (builder.getPath() != null) {
				sb.append(builder.getPath());
			}

			ProjectType projectType = determineProjectType(metadata);
			this.type = projectType.getId();
			sb.append(projectType.getAction());
			builder.setPath(sb.toString());

			if (!this.dependencies.isEmpty()) {
				builder.setParameter("dependencies",
						StringUtils.collectionToCommaDelimitedString(this.dependencies));
			}

			if (this.groupId != null) {
				builder.setParameter("groupId", this.groupId);
			}
			String resolvedArtifactId = resolveArtifactId();
			if (resolvedArtifactId != null) {
				builder.setParameter("artifactId", resolvedArtifactId);
			}
			if (this.version != null) {
				builder.setParameter("version", this.version);
			}
			if (this.name != null) {
				builder.setParameter("name", this.name);
			}
			if (this.description != null) {
				builder.setParameter("description", this.description);
			}
			if (this.packageName != null) {
				builder.setParameter("packageName", this.packageName);
			}
			if (this.type != null) {
				builder.setParameter("type", projectType.getId());
			}
			if (this.packaging != null) {
				builder.setParameter("packaging", this.packaging);
			}
			if (this.javaVersion != null) {
				builder.setParameter("javaVersion", this.javaVersion);
			}
			if (this.language != null) {
				builder.setParameter("language", this.language);
			}
			if (this.bootVersion != null) {
				builder.setParameter("bootVersion", this.bootVersion);
			}

			return builder.build();
		}
		catch (URISyntaxException ex) {
			throw new ReportableException(
					"Invalid service URL (" + ex.getMessage() + ")");
		}
	}
906547
@Trivial
    private static URI getURI(final File file) {
        return AccessController.doPrivileged( new PrivilegedAction<URI>() {
            @Override
            public URI run() {
                return file.toURI();
            }
        } );
    }
801527
public URI call() throws Exception {
		// Save original time stamp for dependency list
		long lastModifiedDep = treeNode.lastModifiedDep();
		long lastModified = resource.lastModified();
		// Parse the javascript code
		Compiler compiler = new Compiler();
		CompilerOptions options = CompilerUtil.getDefaultOptions();
		if (compilerOptionsMap != null) {
			CompilerUtil.applyCompilerOptionsFromMap(options, compilerOptionsMap);
		}
		options.setWarningLevel(DiagnosticGroups.NON_STANDARD_JSDOC,
				CheckLevel.OFF);

		compiler.initOptions(options);
		InputStream in = resource.getInputStream();
		Node node = null;
		try {
			node = compiler.parse(JSSourceFile.fromInputStream(resource.getURI().toString(), in));
			if (compiler.hasErrors()) {
				if (log.isLoggable(Level.WARNING)) {
					JSError[] errors = compiler.getErrors();
					for (JSError error : errors) {
						log.log(Level.WARNING, error.toString());
					}
				}
			}
		} catch (Throwable e) {
			if (log.isLoggable(Level.WARNING)) {
				log.log(Level.WARNING, "Error occurred parsing " + resource.getURI().toString() + ": " + e.getMessage(), e); //$NON-NLS-1$ //$NON-NLS-2$
			}
		} finally {
			in.close();
		}
		if (node != null) {
			// walk the AST for the node looking for define calls
			// and pull out the required dependency list.
			Set<String> features = new HashSet<String>();
			ParseResult parseResult = DepUtils.parseDependencies(node, features);
			Collection<String> defineDeps = parseResult.getDefineDependencies();
			Collection<String> requireDeps = parseResult.getRequireDependencies();
			String[] defineDepArray = (defineDeps == null) ?
					new String[0] : defineDeps.toArray(new String[defineDeps.size()]);
			String[] requireDepArray = (requireDeps == null) ?
					new String[0] : requireDeps.toArray(new String[requireDeps.size()]);
			String[] featureArray = (features == null) ?
					new String[0] : features.toArray(new String[features.size()]);
			/*
			 * Determine if the dependency list has changed.  We keep track of
			 * dependency list changes separate from code changes in general
			 * because a dependency list change necessitates invalidating all
			 * cached responses for the configs that reference this file, and
			 * we want to do this only when necessary.
			 */
			if (lastModifiedDep ==  -1 ||
					!Arrays.equals(defineDepArray, treeNode.getDefineDepArray()) ||
					!Arrays.equals(requireDepArray, treeNode.getRequireDepArray()) ||
					!Arrays.equals(featureArray, treeNode.getDependentFeatures())) {
				lastModifiedDep = lastModified;
			}
			// update the dependency info in the node
			treeNode.setDependencies(defineDepArray, requireDepArray, featureArray,
					lastModified, lastModifiedDep);
		}
		return resource.getURI();
	}
803704
private void parseURI(byte[] data, int start) {
        // at this point, we're parsing /URI [?querystring]
        if (start >= data.length) {
            // PK22096 - default to "/" if not found, should have caught empty
            // string inputs previously (http://host:port is valid)
            this.myURIBytes = SLASH;
            if (tc.isDebugEnabled()) {
                Tr.debug(tc, "Defaulting to slash since no URI data found");
            }
            return;
        }
        int uri_end = data.length;
        for (int i = start; i < data.length; i++) {
            // look for the query string marker
            if ('?' == data[i]) {
                uri_end = i;
                break;
            }
        }
        // save off the URI
        if (start == uri_end) {
            // no uri found
            throw new IllegalArgumentException("Missing URI: " + GenericUtils.getEnglishString(data));
        }
        if (0 == start && uri_end == data.length) {
            this.myURIBytes = data;
        } else {
            this.myURIBytes = new byte[uri_end - start];
            System.arraycopy(data, start, this.myURIBytes, 0, this.myURIBytes.length);
            uri_end++; // jump past the '?'
            if (uri_end < data.length) {
                // save off the query string data
                byte[] query = new byte[data.length - uri_end];
                System.arraycopy(data, uri_end, query, 0, query.length);
                setQueryString(query);
            }
        }
    }
352393
function baseStringUri(uri) {
    var parsed = url.parse(uri);

    //  The port MUST be included if it is not the default port for the
    //  scheme, and MUST be excluded if it is the default.
    if (parsed.protocol === 'https:/') {
        parsed.host = parsed.host.replace(/:443$/, '');
    } else if (parsed.protocol === 'http:/') {
        parsed.host = parsed.host.replace(/:80$/, '');
    }

    return url.format({
        protocol: parsed.protocol,
        host: parsed.host,
        auth: parsed.auth,
        pathname: parsed.pathname
    });
}
934143
function absoluteURI(uri, base) {
    if (uri.substr(0, 2) == './')
      uri = uri.substr(2);

    // absolute urls are left in tact
    if (uri.match(absUrlRegEx) || uri.match(protocolRegEx))
      return uri;
    
    var baseParts = base.split('/');
    var uriParts = uri.split('/');
    
    baseParts.pop();
    
    while (curPart = uriParts.shift())
      if (curPart == '..')
        baseParts.pop();
      else
        baseParts.push(curPart);
    
    return baseParts.join('/');
  }
1308827
public static URI getRootUri(final Archive<?> archive) throws IllegalArgumentException {
        if (archive == null) {
            throw new IllegalArgumentException("Archive must be specified");
        }
        final StringBuilder sb = new StringBuilder();
        sb.append(PROTOCOL);
        sb.append(URI_PROTOCOL_SUFFIX);
        sb.append(archive.getId());
        sb.append('/');
        final URI uri = URI.create(sb.toString());
        return uri;
    }
674987
public <T> T findAny(Class<T> classType, String uri) {
        assertNotEmpty(classType, "Class");
        assertNotEmpty(uri, "uri");
        return couchDbClient.get(URI.create(uri), classType);
    }
742215
public static ClassPath from(URI uri, ClassLoader classLoader) throws IOException {
    Scanner scanner = new Scanner();
    scanner.scan(uri, classLoader);
    return new ClassPath(scanner.getResources());
  }