public class MultipartUtility
extends java.lang.Object
| Constructor and Description | 
|---|
| MultipartUtility(java.net.URL url,
                java.nio.charset.Charset charset)This constructor initializes a new HTTP POST request with content type
 is set to multipart/form-data | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addFilePart(java.lang.String fieldName,
           java.lang.String fileName,
           byte[] data)Adds a upload file section to the request | 
| void | addFormField(java.lang.String name,
            java.lang.String value)Adds a form field to the request | 
| void | addHeaderField(java.lang.String name,
              java.lang.String value)Adds a header field to the request. | 
| java.io.InputStream | finish()Completes the request and receives response from the server. | 
public MultipartUtility(java.net.URL url,
                        java.nio.charset.Charset charset)
url - urlcharset - character setpublic void addFormField(java.lang.String name,
                         java.lang.String value)
name - field namevalue - field valuepublic void addFilePart(java.lang.String fieldName,
                        java.lang.String fileName,
                        byte[] data)
fieldName - name attribute in <input type="file" name="..." />fileName - name of filedata - file bytespublic void addHeaderField(java.lang.String name,
                           java.lang.String value)
name - - name of the header fieldvalue - - value of the header fieldpublic java.io.InputStream finish()