question: public static URI createURIWithQuery ( URI uri , String query ) throws URISyntaxException { String schemeSpecificPart = uri . getRawSchemeSpecificPart ( ) ; int questionMark = schemeSpecificPart . lastIndexOf ( "?" ) ; if ( questionMark < schemeSpecificPart . lastIndexOf ( ")" ) ) { questionMark = - 1 ; } if ( questionMark > 0 ) { schemeSpecificPart = schemeSpecificPart . substring ( 0 , questionMark ) ; } if ( query != null && query . length ( ) > 0 ) { schemeSpecificPart += "?" + query ; } return new URI ( uri . getScheme ( ) , schemeSpecificPart , uri . getFragment ( ) ) ; }
target:  Creates a URI with the given query, removing an previous query value from the given URI.