public class MultipartProcessor
extends java.lang.Object
| Constructor and Description |
|---|
MultipartProcessor(java.net.HttpURLConnection conn,
java.lang.String boundary,
java.lang.String charset)
Constructs a new multipart body builder.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFileField(java.lang.String name,
java.lang.String fileName,
java.io.InputStream inputStream)
Adds a file field to the multipart message, but takes in an InputStream instead of
just a file to read bytes from.
|
void |
addFormField(java.lang.String name,
java.lang.String value)
Adds a form field to the multipart message.
|
void |
finish()
Adds the final boundary to the multipart message and closes streams.
|
static java.lang.String |
getBoundary()
Generates a random MIME multipart boundary.
|
public MultipartProcessor(java.net.HttpURLConnection conn,
java.lang.String boundary,
java.lang.String charset)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String getBoundary()
public void addFormField(java.lang.String name,
java.lang.String value)
name - field namevalue - field valuepublic void addFileField(java.lang.String name,
java.lang.String fileName,
java.io.InputStream inputStream)
throws java.io.IOException
name - Field namefileName - Name of the "file" being uploaded.inputStream - Stream of bytes to use in place of a file.java.io.IOException - Thrown when writing / reading from streams fails.public void finish()
throws java.io.IOException
java.io.IOException