public class MultipartFormWriter
extends java.lang.Object
| Constructor and Description |
|---|
MultipartFormWriter(MultipartFormContentType contentType,
java.io.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(java.lang.String name,
java.lang.String value)
Writes a string field value.
|
void |
writeFile(java.lang.String name,
java.lang.String mimeType,
java.io.File file)
Writes a file's contents.
|
void |
writeFile(java.lang.String name,
java.lang.String mimeType,
java.lang.String fileName,
byte[] data)
Writes the given bytes.
|
void |
writeFile(java.lang.String name,
java.lang.String mimeType,
java.lang.String fileName,
java.io.InputStream is)
Writes a input stream's contents.
|
public MultipartFormWriter(MultipartFormContentType contentType, java.io.OutputStream os)
contentType - The form content typeos - the output streampublic void writeField(java.lang.String name,
java.lang.String value)
throws java.io.IOException
name - the field name (required)value - the field valuejava.io.IOException - on input/output errorspublic void writeFile(java.lang.String name,
java.lang.String mimeType,
java.io.File file)
throws java.io.IOException
name - the field namemimeType - the file content type (optional, recommended)file - the file (the file must exist)java.io.IOException - on input/output errorspublic void writeFile(java.lang.String name,
java.lang.String mimeType,
java.lang.String fileName,
java.io.InputStream is)
throws java.io.IOException
name - The field namemimeType - The file content type (optional, recommended)fileName - The file name (required)is - The input streamjava.io.IOException - on input/output errorspublic void writeFile(java.lang.String name,
java.lang.String mimeType,
java.lang.String fileName,
byte[] data)
throws java.io.IOException
name - the field namemimeType - the file content type (optional, recommended)fileName - the file name (required)data - the file datajava.io.IOException - on input/output errorspublic void close()
throws java.io.IOException
java.io.IOException - on input/output errorsCopyright © 2004-2014 Codehaus. All Rights Reserved.