common/src/main/java/HTTPClient/Codecs.java
/**
     * This method encodes name/value pairs and files into a byte array
     * using the multipart/form-data encoding.
     *
     * @param     opts        the simple form-data to encode (may be null);
     *                        for each NVPair the name refers to the 'name'
     *                        attribute to be used in the header of the part,
     *                        and the value is contents of the part.
     * @param     files       the files to encode (may be null); for each
     *                        NVPair the name refers to the 'name' attribute
     *                        to be used in the header of the part, and the
     *                        value is the actual filename (the file will be
     *                        read and it's contents put in the body of that
     *                        part).
     * @param     ct_hdr      this returns a new NVPair in the 0'th element
     *                        which contains name = "Content-Type",
     *			      value = "multipart/form-data; boundary=..."
     *                        (the reason this parameter is an array is
     *                        because a) that's the only way to simulate
     *                        pass-by-reference and b) you need an array for
     *                        the headers parameter to the Post() or Put()
     *                        anyway).
     * @return                an encoded byte array containing all the opts
     *			      and files.
     * @exception IOException If any file operation fails.
     * @see #mpFormDataEncode(HTTPClient.NVPair[], HTTPClient.NVPair[], HTTPClient.NVPair[], HTTPClient.FilenameMangler)
     */
This method encodes name/value pairs and files into a byte array
using the multipart/form-data encoding.

@param     opts        the simple form-data to encode (may be null);
for each NVPair the name refers to the 'name'
attribute to be used in the header of the part,
and the value is contents of the part.
@param     files       the files to encode (may be null); for each
NVPair the name refers to the 'name' attribute
to be used in the header of the part, and the
value is the actual filename (the file will be
read and it's contents put in the body of that
part).
@param     ct_hdr      this returns a new NVPair in the 0'th element
which contains name = "Content-Type",
value = "multipart/form-data; boundary=..."
(the reason this parameter is an array is
because a) that's the only way to simulate
pass-by-reference and b) you need an array for
the headers parameter to the Post() or Put()
anyway).
@return                an encoded byte array containing all the opts
and files.
@exception IOException If any file operation fails.
This method encodes name / value pairs and files into a byte array using the multipart / form - data encoding . @param opts the simple form - data to encode ( may be null ) ; for each NVPair the name refers to the ' name ' attribute to be used in the header of the part and the value is contents of the part . @param files the files to encode ( may be null ) ; for each NVPair the name refers to the ' name ' attribute to be used in the header of the part and the value is the actual filename ( the file will be read and it ' s contents put in the body of that part ) . @param ct_hdr this returns a new NVPair in the 0 ' th element which contains name = " Content - Type " value = " multipart / form - data ; boundary = ... " ( the reason this parameter is an array is because a ) that ' s the only way to simulate pass - by - reference and b ) you need an array for the headers parameter to the Post () or Put () anyway ) . @return an encoded byte array containing all the opts and files . @exception IOException If any file operation fails .
public final static byte[] mpFormDataEncode(NVPair[] opts, NVPair[] files,
						NVPair[] ct_hdr)
	    throws IOException
    {
	return mpFormDataEncode(opts, files, ct_hdr, null);
    }
public final static byte [ ] mpFormDataEncode ( NVPair [ ] opts , NVPair [ ] files , NVPair [ ] ct_hdr ) throws IOException { return mpFormDataEncode ( opts , files , ct_hdr , null ) ; }
This method encodes name/value pairs and files into a byte array
 using the multipart/form-data encoding.
This method encodes name / value pairs and files into a byte array using the multipart / form - data encoding .