MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / buildQuery

Method buildQuery

vm/JavaAPI/src/java/net/URIHelper.java:446–460  ·  view source on GitHub ↗

Build a URI query string, from a list of Name/Value pairs. This version of the method is useful when the order of the parameters needs to be preserved. The resulting query will not be encoded, so it is suitable to be appended to a URI string. If the query will be passed to a multi-argument URI cons

(List<NameValuePair> parameters)

Source from the content-addressed store, hash-verified

444 * @return a #see {@link #encodeString(String)}
445 */
446 public static String buildQuery(List<NameValuePair> parameters) {
447 StringBuffer query = new StringBuffer();
448 Iterator<NameValuePair> i = parameters.iterator();
449 while(i.hasNext()) {
450 NameValuePair nvp = i.next();
451 query.append(encodeEntities(nvp.getName()));
452 if (nvp.getValue() != null) {
453 query.append(URI.PARAMETER_SEPARATOR);
454 query.append(encodeEntities(nvp.getValue()));
455 }
456 query.append(URI.QUERY_SEPARATOR);
457 }
458 query.deleteCharAt(query.length() - 1);
459 return query.toString();
460 }
461
462 /**
463 * Utility method to build a query string from a hashtable of parameters.

Callers

nothing calls this directly

Calls 12

appendMethod · 0.95
encodeEntitiesMethod · 0.95
getNameMethod · 0.95
getValueMethod · 0.95
deleteCharAtMethod · 0.95
lengthMethod · 0.95
toStringMethod · 0.95
iteratorMethod · 0.65
hasNextMethod · 0.65
nextMethod · 0.65
keySetMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected