Package org.apache.axiom.mime
Interface MultipartWriter
-
public interface MultipartWriter
Deprecated.UseMultipartBodyWriter
instead.Writes a MIME multipart package as used by XOP/MTOM and SOAP with Attachments. Objects implementing this interface are created using aMultipartWriterFactory
. MIME parts are written usingwritePart(String, String, String)
orwritePart(DataHandler, String, String)
. Calls to both methods can be mixed, i.e. it is not required to use the same method for all MIME parts. Instead, the caller should choose the most convenient method for each part (depending on the form in which the content is available). After all parts have been written,complete()
must be called to write the final MIME boundary.The following semantics are defined for the
contentTransferEncoding
andcontentID
arguments of the two write methods:- It is the responsibility of the implementation to apply the content transfer encoding
as specified by the
contentTransferEncoding
argument. The caller only provides the unencoded data. The implementation should support at leastbinary
andbase64
. If it doesn't support the specified encoding, it may use an alternative one. In any case, the implementation must make sure that the MIME part has aContent-Transfer-Encoding
header appropriate for the applied encoding. - The content ID passed as argument is always the raw ID (without the angle brackets).
It is the responsibility of the implementation to properly format the value
of the
Content-ID
header.
- It is the responsibility of the implementation to apply the content transfer encoding
as specified by the
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
complete()
Deprecated.Complete writing of the MIME multipart package.OutputStream
writePart(String contentType, String contentTransferEncoding, String contentID)
Deprecated.Start writing a MIME part.OutputStream
writePart(String contentType, String contentTransferEncoding, String contentID, List<org.apache.axiom.mime.Header> extraHeaders)
Deprecated.Start writing a MIME part.void
writePart(DataHandler dataHandler, String contentTransferEncoding, String contentID)
Deprecated.Write a MIME part.void
writePart(DataHandler dataHandler, String contentTransferEncoding, String contentID, List<org.apache.axiom.mime.Header> extraHeaders)
Deprecated.Write a MIME part.
-
-
-
Method Detail
-
writePart
OutputStream writePart(String contentType, String contentTransferEncoding, String contentID) throws IOException
Deprecated.Start writing a MIME part. The methods returns anOutputStream
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.- Parameters:
contentType
- the value of theContent-Type
header of the MIME partcontentTransferEncoding
- the content transfer encoding to be used (see above); must not benull
contentID
- the content ID of the MIME part (see above)- Returns:
- an output stream to write the content of the MIME part
- Throws:
IOException
- if an I/O error occurs when writing to the underlying stream
-
writePart
OutputStream writePart(String contentType, String contentTransferEncoding, String contentID, List<org.apache.axiom.mime.Header> extraHeaders) throws IOException
Deprecated.Start writing a MIME part. The method is similar towritePart(String, String, String)
but accepts a list of additional headers for the MIME part.- Parameters:
contentType
- the value of theContent-Type
header of the MIME partcontentTransferEncoding
- the content transfer encoding to be used (see above); must not benull
contentID
- the content ID of the MIME part (see above)extraHeaders
- a list ofHeader
objects with additional headers to write to the MIME part- Returns:
- an output stream to write the content of the MIME part
- Throws:
IOException
- if an I/O error occurs when writing to the underlying stream
-
writePart
void writePart(DataHandler dataHandler, String contentTransferEncoding, String contentID) throws IOException
Deprecated.Write a MIME part. The content is provided by aDataHandler
object, which also specifies the content type of the part.- Parameters:
dataHandler
- the content of the MIME part to writecontentTransferEncoding
- the content transfer encoding to be used (see above); must not benull
contentID
- the content ID of the MIME part (see above)- Throws:
IOException
- if an I/O error occurs when writing the part to the underlying stream
-
writePart
void writePart(DataHandler dataHandler, String contentTransferEncoding, String contentID, List<org.apache.axiom.mime.Header> extraHeaders) throws IOException
Deprecated.Write a MIME part. The content is provided by aDataHandler
object, which also specifies the content type of the part. The method is similar towritePart(DataHandler, String, String)
but accepts a list of additional headers for the MIME part.- Parameters:
dataHandler
- the content of the MIME part to writecontentTransferEncoding
- the content transfer encoding to be used (see above); must not benull
contentID
- the content ID of the MIME part (see above)extraHeaders
- a list ofHeader
objects with additional headers to write to the MIME part- Throws:
IOException
- if an I/O error occurs when writing the part to the underlying stream
-
complete
void complete() throws IOException
Deprecated.Complete writing of the MIME multipart package. This method does not close the underlying stream.- Throws:
IOException
- if an I/O error occurs when writing to the underlying stream
-
-