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

Method parseQueryOrdered

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

Parse a URI query string, returning a list of Name/Value pairs in the order they occur in the query and keeping duplicates. @param query a decoded URI query string. @return ordered list name/value pairs.

(String query)

Source from the content-addressed store, hash-verified

407 * @return ordered list name/value pairs.
408 */
409 public static List<NameValuePair> parseQueryOrdered(String query) throws URISyntaxException {
410 List<NameValuePair> parameters = new ArrayList<NameValuePair>();
411 if (query == null) {
412 return parameters;
413 }
414 URIQueryTokenizer uqt = new URIQueryTokenizer(query);
415 while (uqt.hasMoreTokens()) {
416 String token = uqt.nextToken();
417 int index = token.indexOf(URI.PARAMETER_SEPARATOR);
418 String name;
419 String value;
420 if (index != -1) {
421 name = token.substring(0, index);
422 value = token.substring(index + 1);
423 } else {
424 name = token;
425 value = null;
426 }
427 parameters.add(new NameValuePair(name, value));
428 }
429 return parameters;
430 }
431
432 /**
433 * Build a URI query string, from a list of Name/Value pairs. This version

Callers 1

parseQueryMethod · 0.95

Calls 5

hasMoreTokensMethod · 0.95
nextTokenMethod · 0.95
indexOfMethod · 0.95
substringMethod · 0.95
addMethod · 0.95

Tested by

no test coverage detected