public class MultipartFormWriter extends Object
| Constructor and Description |
|---|
MultipartFormWriter(MultipartFormContentType contentType,
OutputStream os)
Attaches to the outputstream and allows writing form data or files to it.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the writer.
|
void |
writeField(String name,
String value)
Writes a string field value.
|
void |
writeFile(String name,
String mimeType,
File file)
Writes a file's contents.
|
void |
writeFile(String name,
String mimeType,
String fileName,
byte[] data)
Writes the given bytes.
|
void |
writeFile(String name,
String mimeType,
String fileName,
InputStream is)
Writes a input stream's contents.
|
public MultipartFormWriter(MultipartFormContentType contentType, OutputStream os)
contentType - The form content typeos - the output streampublic void writeField(String name, String value) throws IOException
name - the field name (required)value - the field valueIOException - on input/output errorspublic void writeFile(String name, String mimeType, File file) throws IOException
name - the field namemimeType - the file content type (optional, recommended)file - the file (the file must exist)IOException - on input/output errorspublic void writeFile(String name, String mimeType, String fileName, InputStream is) throws IOException
name - The field namemimeType - The file content type (optional, recommended)fileName - The file name (required)is - The input streamIOException - on input/output errorspublic void writeFile(String name, String mimeType, String fileName, byte[] data) throws IOException
name - the field namemimeType - the file content type (optional, recommended)fileName - the file name (required)data - the file dataIOException - on input/output errorspublic void close()
throws IOException
IOException - on input/output errorsCopyright © 2004–2015 Github. All rights reserved.