class MultipartWriterImpl extends java.lang.Object implements MultipartWriter
| Modifier and Type | Class and Description |
|---|---|
(package private) class |
MultipartWriterImpl.PartOutputStream |
| Modifier and Type | Field and Description |
|---|---|
private byte[] |
boundary |
private static byte[] |
CR_LF |
private static byte[] |
DASH_DASH |
private java.io.OutputStream |
out |
| Constructor and Description |
|---|
MultipartWriterImpl(java.io.OutputStream out,
java.lang.String boundary) |
| Modifier and Type | Method and Description |
|---|---|
void |
complete()
Complete writing of the MIME multipart package.
|
void |
writePart(javax.activation.DataHandler dataHandler,
java.lang.String contentTransferEncoding,
java.lang.String contentID)
Write a MIME part.
|
void |
writePart(javax.activation.DataHandler dataHandler,
java.lang.String contentTransferEncoding,
java.lang.String contentID,
java.util.List extraHeaders)
Write a MIME part.
|
java.io.OutputStream |
writePart(java.lang.String contentType,
java.lang.String contentTransferEncoding,
java.lang.String contentID)
Start writing a MIME part.
|
java.io.OutputStream |
writePart(java.lang.String contentType,
java.lang.String contentTransferEncoding,
java.lang.String contentID,
java.util.List extraHeaders)
Start writing a MIME part.
|
private static final byte[] DASH_DASH
private static final byte[] CR_LF
private final java.io.OutputStream out
private final byte[] boundary
public MultipartWriterImpl(java.io.OutputStream out,
java.lang.String boundary)
public java.io.OutputStream writePart(java.lang.String contentType,
java.lang.String contentTransferEncoding,
java.lang.String contentID)
throws java.io.IOException
MultipartWriterOutputStream that the caller can
use to write the content of the MIME part. After writing the content,
OutputStream.close() must be called to complete the writing of the MIME part.writePart in interface MultipartWritercontentType - the value of the Content-Type header of the MIME partcontentTransferEncoding - the content transfer encoding to be used (see above); must not be
nullcontentID - the content ID of the MIME part (see above)java.io.IOException - if an I/O error occurs when writing to the underlying streampublic java.io.OutputStream writePart(java.lang.String contentType,
java.lang.String contentTransferEncoding,
java.lang.String contentID,
java.util.List extraHeaders)
throws java.io.IOException
MultipartWriterMultipartWriter.writePart(String, String, String) but accepts a list of additional headers for the
MIME part.writePart in interface MultipartWritercontentType - the value of the Content-Type header of the MIME partcontentTransferEncoding - the content transfer encoding to be used (see above); must not be
nullcontentID - the content ID of the MIME part (see above)extraHeaders - a list of Header objects with additional headers to write to the MIME partjava.io.IOException - if an I/O error occurs when writing to the underlying streampublic void writePart(javax.activation.DataHandler dataHandler,
java.lang.String contentTransferEncoding,
java.lang.String contentID,
java.util.List extraHeaders)
throws java.io.IOException
MultipartWriterDataHandler object, which also
specifies the content type of the part. The method is similar to
MultipartWriter.writePart(DataHandler, String, String) but accepts a list of additional headers for
the MIME part.writePart in interface MultipartWriterdataHandler - the content of the MIME part to writecontentTransferEncoding - the content transfer encoding to be used (see above); must not be
nullcontentID - the content ID of the MIME part (see above)extraHeaders - a list of Header objects with additional headers to write to the MIME partjava.io.IOException - if an I/O error occurs when writing the part to the underlying streampublic void writePart(javax.activation.DataHandler dataHandler,
java.lang.String contentTransferEncoding,
java.lang.String contentID)
throws java.io.IOException
MultipartWriterDataHandler object, which also
specifies the content type of the part.writePart in interface MultipartWriterdataHandler - the content of the MIME part to writecontentTransferEncoding - the content transfer encoding to be used (see above); must not be
nullcontentID - the content ID of the MIME part (see above)java.io.IOException - if an I/O error occurs when writing the part to the underlying streampublic void complete()
throws java.io.IOException
MultipartWritercomplete in interface MultipartWriterjava.io.IOException - if an I/O error occurs when writing to the underlying stream