Here you can find the source of addParam(Map
Parameter | Description |
---|---|
strParam | param line in the format param=value |
public static void addParam(Map<String, Object> properties, String strParams, boolean bDecodeString)
//package com.java2s; import java.net.URLDecoder; import java.util.Map; public class Main { public final static String URL_ENCODING = "UTF-8"; /**/*from w w w. ja v a 2 s. c o m*/ * Parse the param line and add it to this properties object. * (ie., key=value). * @properties The properties object to add this params to. * @param strParam param line in the format param=value */ public static void addParam(Map<String, Object> properties, String strParams, boolean bDecodeString) { int iIndex = strParams.indexOf('='); int iEndIndex = strParams.length(); if (iIndex != -1) { String strParam = strParams.substring(0, iIndex); String strValue = strParams.substring(iIndex + 1, iEndIndex); if (bDecodeString) { try { strParam = URLDecoder.decode(strParam, URL_ENCODING); strValue = URLDecoder.decode(strValue, URL_ENCODING); } catch (java.io.UnsupportedEncodingException ex) { ex.printStackTrace(); } } properties.put(strParam, strValue); } } }