Java String Encode encodeMap(Map map, String enc)

Here you can find the source of encodeMap(Map map, String enc)

Description

encode Map

License

Open Source License

Declaration

public static void encodeMap(Map map, String enc) 

Method Source Code

//package com.java2s;
import java.io.UnsupportedEncodingException;

import java.net.URLEncoder;

import java.util.Map;

import java.util.Set;

public class Main {
    public static void encodeMap(Map map, String enc) {
        if (null != map) {
            Set<String> keySet = map.keySet();
            for (String key : keySet) {
                if (key.equals("sign") || key.equals("sign_type")) {
                    continue;
                } else {
                    try {
                        map.put(key,//from  ww w.j a  v a 2s . c o m
                                URLEncoder.encode(map.get(key) + "", enc));
                    } catch (UnsupportedEncodingException e) {
                        e.printStackTrace();
                    }

                }
            }
        }
    }
}

Related

  1. encodeFilenameOmittingWhiteSpaces(String filename, String encoding)
  2. encodeForm(Map form)
  3. encodeIncludingSpecialCharacters(String toEncode)
  4. encodeInternally(String s)
  5. encodeJobHistoryFileName(String logFileName)
  6. encodeName(final String name)
  7. encodeName(String createdName)
  8. encodeParameter(String key, String value)
  9. encodeParameters(Map> parameters)