code: private static List<Parameter> extractQueryParameters(String rawQuery) {
          List<Parameter> results = new ArrayList<>();
          int endIndex = rawQuery.length() - 1;
          int index = 0;
          while (0 <= index && index <= endIndex) {
              /*
               * Ideally we should first look for '&', then look for '=' before
               * the '&', but obviously that's not how AWS understand query
               * parsing; see the test "post-vanilla-query-nonunreserved" in the
               * test suite. A string such as "?foo&bar=qux" will be understood as
               * one parameter with name "foo&bar" and value "qux". Don't ask me
               * why.
               */
              String name;
              String value;
              int nameValueSeparatorIndex = rawQuery.indexOf(QUERY_PARAMETER_VALUE_SEPARATOR, index);
              if (nameValueSeparatorIndex < 0) {
                  // No value
                  name = rawQuery.substring(index);
                  value = null;
  
                  index = endIndex + 1;
              } else {
                  int parameterSeparatorIndex = rawQuery.indexOf(QUERY_PARAMETER_SEPARATOR, nameValueSeparatorIndex);
                  if (parameterSeparatorIndex < 0) {
                      parameterSeparatorIndex = endIndex + 1;
                  }
                  name = rawQuery.substring(index, nameValueSeparatorIndex);
                  value = rawQuery.substring(nameValueSeparatorIndex + 1, parameterSeparatorIndex);
  
                  index = parameterSeparatorIndex + 1;
              }
  
              results.add(new Parameter(name, value));
          }
          return results;
      }
docs: Extract parameters from a query string, preserving encoding.
  <p>
  We can't use Apache HTTP Client's URLEncodedUtils.parse, mainly because
  we don't want to decode names/values.
  
  @param rawQuery
  the query to parse
  @return The list of parameters, in the order they were found.