code: public void setQuery(String query) throws URIException {
          if (query == null || query.length() == 0) {
              _query = (query == null) ? null : query.toCharArray();
              setURI();
              return;
          }
          setRawQuery(encode(query, allowed_query, getProtocolCharset()));
      }
docs: Set the query.
  <p>
  When a query string is not misunderstood the reserved special characters
  ("&amp;", "=", "+", ",", and "$") within a query component, it is
  recommended to use in encoding the whole query with this method.
  <p>
  The additional APIs for the special purpose using by the reserved
  special characters used in each protocol are implemented in each protocol
  classes inherited from <code>URI</code>.  So refer to the same-named APIs
  implemented in each specific protocol instance.
  
  @param query the query string.
  @throws URIException incomplete trailing escape pattern or unsupported
  character encoding
  @see #encode