Package org.apache.axiom.om.impl
Class OMMultipartWriter
- java.lang.Object
-
- org.apache.axiom.om.impl.OMMultipartWriter
-
public class OMMultipartWriter extends Object
Writes a MIME multipart package as used by XOP/MTOM and SOAP with Attachments. This class wraps aMultipartBodyWriter, providing a higher level API. In particular it will configure content types and content transfer encodings based on information from anOMOutputFormatobject.
-
-
Constructor Summary
Constructors Constructor Description OMMultipartWriter(OutputStream out, OMOutputFormat format)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcomplete()Complete writing of the MIME multipart package.StringgetRootPartContentType()Get the content type of the root part, as determined by theOMOutputFormatpassed to the constructor of this object.OutputStreamwritePart(String contentType, String contentID)Start writing an attachment part of the MIME package.OutputStreamwritePart(String contentType, String contentID, List<Header> extraHeaders)Start writing an attachment part of the MIME package.voidwritePart(DataHandler dataHandler, String contentID)Write a MIME part.voidwritePart(DataHandler dataHandler, String contentID, List<Header> extraHeaders)Write a MIME part.OutputStreamwriteRootPart()Start writing the root part of the MIME package.
-
-
-
Constructor Detail
-
OMMultipartWriter
public OMMultipartWriter(OutputStream out, OMOutputFormat format)
-
-
Method Detail
-
getRootPartContentType
public String getRootPartContentType()
Get the content type of the root part, as determined by theOMOutputFormatpassed to the constructor of this object.- Returns:
- the content type of the root part
-
writeRootPart
public OutputStream writeRootPart() throws IOException
Start writing the root part of the MIME package. This method delegates toMultipartBodyWriter.writePart(String, String, String, List), but computes the content type, content transfer encoding and content ID from theOMOutputFormat.- 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
public OutputStream writePart(String contentType, String contentID) throws IOException
Start writing an attachment part of the MIME package. This method delegates toMultipartBodyWriter.writePart(String, String, String, List), but computes the content transfer encoding based on the content type and theOMOutputFormat.- Parameters:
contentType- the content type of the MIME part to writecontentID- the content ID of 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
public OutputStream writePart(String contentType, String contentID, List<Header> extraHeaders) throws IOException
Start writing an attachment part of the MIME package. This method delegates toMultipartBodyWriter.writePart(String, String, String, List), but computes the content transfer encoding based on the content type and theOMOutputFormat.- Parameters:
contentType- the content type of the MIME part to writecontentID- the content ID of the MIME partextraHeaders- a list ofHeaderobjects 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
public void writePart(DataHandler dataHandler, String contentID, List<Header> extraHeaders) throws IOException
Write a MIME part. This method delegates toMultipartBodyWriter.writePart(DataHandler, String, String, List), but computes the appropriate content transfer encoding from theOMOutputFormat.- Parameters:
dataHandler- the content of the MIME part to writecontentID- the content ID of the MIME partextraHeaders- a list ofHeaderobjects 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
-
writePart
public void writePart(DataHandler dataHandler, String contentID) throws IOException
Write a MIME part. This method delegates toMultipartBodyWriter.writePart(DataHandler, String, String, List), but computes the appropriate content transfer encoding from theOMOutputFormat.- Parameters:
dataHandler- the content of the MIME part to writecontentID- the content ID of the MIME part- Throws:
IOException- if an I/O error occurs when writing the part to the underlying stream
-
complete
public void complete() throws IOExceptionComplete writing of the MIME multipart package. This method delegates toMultipartBodyWriter.complete().- Throws:
IOException- if an I/O error occurs when writing to the underlying stream
-
-