public static EncodedPair toPair(String name, String value, Charset charset, boolean encoded) throws UnsupportedEncodingException {
        String nameEncoded;
        String valueEncoded;
        if(encoded){
            nameEncoded = name;
            valueEncoded = value;
        }else{
            nameEncoded = encode(name, charset);
            valueEncoded = encode(value, charset);
        }
        return new SimpleEncodedPair(nameEncoded, valueEncoded);
    }
public static EncodedPair toPair ( String name , String value , Charset charset , boolean encoded ) throws UnsupportedEncodingException { String nameEncoded ; String valueEncoded ; if ( encoded ) { nameEncoded = name ; valueEncoded = value ; } else { nameEncoded = encode ( name , charset ) ; valueEncoded = encode ( value , charset ) ; } return new SimpleEncodedPair ( nameEncoded , valueEncoded ) ; }
<p>Returns a EncodedPair with the given name/value.</p>
<p>The encoded flag indicates if name/value need to be encoded with the given charset.</p>
@param name name to encode if encoded is set to true
@param value value to encode if encoded is set to true
@param charset charset to use while encoding the name/value if encoded is set to true
@param encoded if true, name/value will be encoded
@return the encoded pair object
@throws UnsupportedEncodingException When the given charset is not supported