/** * MAP类型数组转换成NameValuePair类型 * @param map MAP类型数组 * @return NameValuePair类型数组 */ private static NameValuePair[] generatNameValuePair(Map<String, String> map,String charset) throws Exception { NameValuePair[] nameValuePair = new NameValuePair[map.size()]; int i = 0; for (Map.Entry<String, String> entry : map.entrySet()) { nameValuePair[i++] = new NameValuePair(entry.getKey(), URLEncoder.encode(entry.getValue(), charset)); } return nameValuePair; } |
|
来自: 昵称10711656 > 《JAVA》