common/src/main/java/HTTPClient/Codecs.java
/**
     * Turns an array of name/value pairs into the string
     * "name1=value1&name2=value2&name3=value3". The names and values are
     * first urlencoded. This is the form in which form-data is passed to
     * a cgi script.
     *
     * @param pairs the array of name/value pairs
     * @return a string containg the encoded name/value pairs
     */
Turns an array of name/value pairs into the string
"name1=value1&name2=value2&name3=value3". The names and values are
first urlencoded. This is the form in which form-data is passed to
a cgi script.

@param pairs the array of name/value pairs
@return a string containg the encoded name/value pairs
Turns an array of name / value pairs into the string " name1 = value1&name2 = value2&name3 = value3 " . The names and values are first urlencoded . This is the form in which form - data is passed to a cgi script . @param pairs the array of name / value pairs @return a string containg the encoded name / value pairs
public final static String nv2query(NVPair pairs[])
    {
	if (pairs == null)
	    return null;
	int          idx;
	StringBuffer qbuf = new StringBuffer();
	for (idx = 0; idx < pairs.length; idx++)
	{
	    if (pairs[idx] != null)
		qbuf.append(URLEncode(pairs[idx].getName()) + "=" +
			    URLEncode(pairs[idx].getValue()) + "&");
	}
	if (qbuf.length() > 0)
	    qbuf.setLength(qbuf.length()-1);	
	return qbuf.toString();
    }
public final static String nv2query ( NVPair pairs [ ] ) { if ( pairs == null ) return null ; int idx ; StringBuffer qbuf = new StringBuffer ( ) ; for ( idx = 0 ; idx < pairs . length ; idx ++ ) { if ( pairs [ idx ] != null ) qbuf . append ( URLEncode ( pairs [ idx ] . getName ( ) ) + "=" + URLEncode ( pairs [ idx ] . getValue ( ) ) + "&" ) ; } if ( qbuf . length ( ) > 0 ) qbuf . setLength ( qbuf . length ( ) - 1 ) ; return qbuf . toString ( ) ; }
Turns an array of name/value pairs into the string
 "name1=value1&name2=value2&name3=value3".
Turns an array of name / value pairs into the string " name1 = value1&name2 = value2&name3 = value3 " .
// remove trailing '&'