Java String Encode encodeToForm(Map msg)

Here you can find the source of encodeToForm(Map msg)

Description

encode To Form

License

Open Source License

Declaration

public static String encodeToForm(Map msg) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.*;

import java.net.*;

public class Main {
    public static String encodeToForm(Map msg) {
        StringBuffer sb = new StringBuffer();

        String name;//from w  w w .  j av a2 s  .  co  m
        Object value;
        Iterator it = msg.keySet().iterator();
        while (it.hasNext()) {
            name = (String) it.next();
            value = URLEncoder.encode((String) msg.get(name));
            sb.append(name + "=" + value);
            if (it.hasNext())
                sb.append("&");
        }
        return sb.toString();
    }
}

Related

  1. encodeText(String str, String fromEnc, String toEnc)
  2. encodeTexts(String s)
  3. encodeTextValue(char[] characters, int offset, int length, Writer writer)
  4. encodeThoroughly(String s)
  5. encodeToFlex(Object o)
  6. encodeToString(String s)
  7. encodeURNComponent(String value)
  8. encodeUTF8(String input, boolean keepSpaces)
  9. encodeUTF8(String s)