Here you can find the source of encodeParams(String encoding, String... params)
Parameter | Description |
---|---|
encoding | Encoding. |
params | Parameters to be encoded. |
Parameter | Description |
---|---|
UnsupportedEncodingException | If the encoding is not supported. |
public static List<String> encodeParams(String encoding, String... params) throws UnsupportedEncodingException
//package com.java2s; //License from project: Open Source License import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.Arrays; import java.util.List; public class Main { /**//from ww w . java2s . c om * Encodes the list of path parts that will be separated by /. * * @param encoding * Encoding. * @param params * Parameters to be encoded. * @return The encoded array of parameters. * @throws UnsupportedEncodingException * If the encoding is not supported. */ public static List<String> encodeParams(String encoding, String... params) throws UnsupportedEncodingException { List<String> encodedParams = Arrays.asList(params); for (int i = 0; i < encodedParams.size(); ++i) { encodedParams.set(i, URLEncoder.encode(params[i], encoding)); } return encodedParams; } }