Java URL Parameter Builder getParameterMap(byte[] bytea)

Here you can find the source of getParameterMap(byte[] bytea)

Description

get Parameter Map

License

Apache License

Declaration

public static Map<String, String> getParameterMap(byte[] bytea) throws Exception 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.net.URLDecoder;
import java.util.HashMap;
import java.util.Map;

public class Main {
    public static final String SJIS_ENCODE = "windows-31j";

    public static Map<String, String> getParameterMap(byte[] bytea) throws Exception {
        Map<String, String> map = new HashMap<String, String>();

        String rawstr = new String(bytea, SJIS_ENCODE);
        String[] ampsplit = rawstr.split("&");

        for (String str : ampsplit) {
            String[] params = str.split("=");
            String value = "";
            if (params.length > 1 && (params[1] != null) && (params[1].length() > 0)) {
                value = URLDecoder.decode(params[1], SJIS_ENCODE);
            }/*from   ww  w .j  a v  a 2s .co  m*/
            map.put(params[0], value);
        }

        return map;
    }
}

Related

  1. convertToParameterString(Map parameterMap)
  2. extractParameters(String parameterString)
  3. format(final Map> parameters, final String encoding)
  4. format(Map parameters, final String encoding)
  5. getParameter(String source, int index)
  6. getParams(String str)
  7. getUrlParameters(final String url)
  8. getUrlParameters(String url)
  9. getUrlParameters(String url)