public static String encodeUri(final String uri, final String encoding) {
    """
	Encodes the given source URI into an encoded String. All various URI components are
	encoded according to their respective valid character sets.
	<p>This method does <b>not</b> attempt to encode "=" and "{@literal &}"
	characters in query parameter names and query parameter values because they cannot
	be parsed in a reliable way.
    """
		Matcher m = URI_PATTERN.matcher(uri);
		if (m.matches()) {
			String scheme = m.group(2);
			String authority = m.group(3);
			String userinfo = m.group(5);
			String host = m.group(6);
			String port = m.group(8);
			String path = m.group(9);
			String query = m.group(11);
			String fragment = m.group(13);

			return encodeUriComponents(scheme, authority, userinfo, host, port, path, query, fragment, encoding);
		}
		throw new IllegalArgumentException("Invalid URI: " + uri);
	}
public static String encodeUri(final String uri, final String encoding) {
		Matcher m = URI_PATTERN.matcher(uri);
		if (m.matches()) {
			String scheme = m.group(2);
			String authority = m.group(3);
			String userinfo = m.group(5);
			String host = m.group(6);
			String port = m.group(8);
			String path = m.group(9);
			String query = m.group(11);
			String fragment = m.group(13);

			return encodeUriComponents(scheme, authority, userinfo, host, port, path, query, fragment, encoding);
		}
		throw new IllegalArgumentException("Invalid URI: " + uri);
	}
public static String encodeUri ( final String uri , final String encoding ) { Matcher m = URI_PATTERN . matcher ( uri ) ; if ( m . matches ( ) ) { String scheme = m . group ( 2 ) ; String authority = m . group ( 3 ) ; String userinfo = m . group ( 5 ) ; String host = m . group ( 6 ) ; String port = m . group ( 8 ) ; String path = m . group ( 9 ) ; String query = m . group ( 11 ) ; String fragment = m . group ( 13 ) ; return encodeUriComponents ( scheme , authority , userinfo , host , port , path , query , fragment , encoding ) ; } throw new IllegalArgumentException ( "Invalid URI: " + uri ) ; }
Encodes the given source URI into an encoded String. All various URI components are
encoded according to their respective valid character sets.
<p>This method does <b>not</b> attempt to encode "=" and "{@literal &}"
characters in query parameter names and query parameter values because they cannot
be parsed in a reliable way.
Encodes the given source URI into an encoded String . All various URI components are encoded according to their respective valid character sets . <p > This method does <b > not< / b > attempt to encode = and {