Create new URI with a given fragment.

@param path URI to set fragment on
@param fragment new fragment, {@code null} for no fragment
@return new URI instance with given fragment
550354
public static URI setFragment(final URI path, final String fragment) {
        try {
            if (path.getPath() != null) {
                return new URI(path.getScheme(), path.getUserInfo(), path.getHost(), path.getPort(), path.getPath(), path.getQuery(), fragment);
            } else {
                return new URI(path.getScheme(), path.getSchemeSpecificPart(), fragment);
            }
        } catch (final URISyntaxException e) {
            throw new RuntimeException(e.getMessage(), e);
        }
    }
663131
public static Uri getFileUri(Fragment fragment, File file) {
        return getFileUri(fragment.getContext(), file);
    }
493471
public UriComponentsBuilder uri(URI uri) {
		Assert.notNull(uri, "'uri' must not be null");
		this.scheme = uri.getScheme();
		if (uri.isOpaque()) {
			this.ssp = uri.getRawSchemeSpecificPart();
			resetHierarchicalComponents();
		}
		else {
			if (uri.getRawUserInfo() != null) {
				this.userInfo = uri.getRawUserInfo();
			}
			if (uri.getHost() != null) {
				this.host = uri.getHost();
			}
			if (uri.getPort() != -1) {
				this.port = String.valueOf(uri.getPort());
			}
			if (StringUtils.hasLength(uri.getRawPath())) {
				this.pathBuilder = new CompositePathComponentBuilder(uri.getRawPath());
			}
			if (StringUtils.hasLength(uri.getRawQuery())) {
				this.queryParams.clear();
				query(uri.getRawQuery());
			}
			resetSchemeSpecificPart();
		}
		if (uri.getRawFragment() != null) {
			this.fragment = uri.getRawFragment();
		}
		return this;
	}
1100011
public static URI setElementID(final URI relativePath, final String id) {
        String topic = getTopicID(relativePath);
        if (topic != null) {
            return setFragment(relativePath, topic + (id != null ? SLASH + id : ""));
        } else if (id == null) {
            return stripFragment(relativePath);
        } else {
            throw new IllegalArgumentException(relativePath.toString());
        }
    }
1308797
public static Image newActionImage (String path, ClickHandler onClick)
    {
        return newActionImage(path, null, onClick);
    }
659811
public static URI addPathComponent(URI uri, String component) {
        if (uri != null && component != null) try {
            return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(),
                    Optional.ofNullable(uri.getPath()).map(path -> join(path, component, '/')).orElse(component),
                    uri.getQuery(), uri.getFragment());
        } catch (URISyntaxException use) {
            throw new IllegalArgumentException("Could not add path component \"" + component + "\" to " + uri + ": "
                    + use.getMessage(), use);
        }
        return uri;
    }
1026817
@Deprecated
    public <T> MutateInBuilder upsert(String path, T fragment, boolean createPath) {
        asyncBuilder.upsert(path, fragment, new SubdocOptionsBuilder().createPath(createPath));
        return this;
    }
74156
public static String createPath(String... segments) {

    int length = 0;
    for (String s : segments) {
      if (length > 0) {
        length++;
      }
      length = length + s.length();
    }
    StringBuilder buffer = new StringBuilder(length);
    appendPath(buffer, segments);
    return buffer.toString();
  }
382873
public static File file(String path) {
		if (StrUtil.isBlank(path)) {
			throw new NullPointerException("File path is blank!");
		}
		return new File(getAbsolutePath(path));
	}
1346721
public static UriTemplate append(UriTemplate uriTemplate, String fragment) {
    return new UriTemplate(uriTemplate.toString() + fragment, uriTemplate.encodeSlash(),
        uriTemplate.getCharset());
  }
1029512
public void setRawPath(char[] escapedPath) throws URIException {
        if (escapedPath == null || escapedPath.length == 0) {
            _path = _opaque = escapedPath;
            setURI();
            return;
        }
        // remove the fragment identifier
        escapedPath = removeFragmentIdentifier(escapedPath);
        if (_is_net_path || _is_abs_path) {
            if (escapedPath[0] != '/') {
                throw new URIException(URIException.PARSING,
                        "not absolute path");
            }
            if (!validate(escapedPath, abs_path)) {
                throw new URIException(URIException.ESCAPING,
                        "escaped absolute path not valid");
            }
            _path = escapedPath;
        } else if (_is_rel_path) {
            int at = indexFirstOf(escapedPath, '/');
            if (at == 0) {
                throw new URIException(URIException.PARSING, "incorrect path");
            }
            if (at > 0 && !validate(escapedPath, 0, at - 1, rel_segment) 
                && !validate(escapedPath, at, -1, abs_path) 
                || at < 0 && !validate(escapedPath, 0, -1, rel_segment)) {
            
                throw new URIException(URIException.ESCAPING,
                        "escaped relative path not valid");
            }
            _path = escapedPath;
        } else if (_is_opaque_part) {
            if (!uric_no_slash.get(escapedPath[0]) 
                && !validate(escapedPath, 1, -1, uric)) {
                throw new URIException(URIException.ESCAPING,
                    "escaped opaque part not valid");
            }
            _opaque = escapedPath;
        } else {
            throw new URIException(URIException.PARSING, "incorrect path");
        }
        setURI();
    }
638034
public void visit(final URI path) {
        final URI localPath = stripFragment(path).normalize();
        visitSet.add(localPath);
    }
199905
public PactDslRequestWithPath path(String path) {
        return new PactDslRequestWithPath(consumerPactBuilder, consumerName, providerName, pactDslWithState.state,
          description, path, requestMethod, requestHeaders, query, requestBody, requestMatchers, requestGenerators,
          defaultRequestValues, defaultResponseValues);
    }
349808
public void setPath(String path)
    {
        if (getState() != __MSG_EDITABLE) throw new IllegalStateException("Not EDITABLE");
        if (_uri == null)
            _uri = new URI(path);
        else
            _uri.setURI(path);
    }
1119946
public ResolvedRequest withPath( String path ) {
        assert repositoryName != null;
        assert workspaceName != null;
        return new ResolvedRequest(request, repositoryName, workspaceName, path);
    }
115895
public boolean addPath(String path) throws MalformedURLException {
        File file = new File(path);
        return addPath( file );
    }
562352
public URIBuilder setPath(final String path) {
		 this.path = path;
		 this.encodedSchemeSpecificPart = null;
		 this.encodedPath = null;
		 return this;
	 }