public class MultipartProcessor
extends java.lang.Object
Constructor and Description |
---|
MultipartProcessor(java.io.OutputStream outputStream,
java.lang.String boundary,
java.nio.charset.Charset 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.
|
public MultipartProcessor(java.io.OutputStream outputStream, java.lang.String boundary, java.nio.charset.Charset charset) throws java.io.IOException
java.io.IOException
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