Package org.cip4.jdflib.util.mime
Class MimeWriter
java.lang.Object
org.cip4.jdflib.util.mime.MimeHelper
org.cip4.jdflib.util.mime.MimeWriter
- All Implemented Interfaces:
IStreamWriter
class to create and write mime files
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsFields inherited from class org.cip4.jdflib.util.mime.MimeHelper
markSize, theMultipart -
Constructor Summary
ConstructorsConstructorDescriptionMimeWriter(javax.mail.Multipart mp) MimeWriter(MimeWriter.eMimeSubType subtype) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidbuildMimePackage(Vector<? extends XMLDoc> vXMLDocs) Builds a MIME package.voidbuildMimePackage(JDFDoc docJMF, XMLDoc docJDF, boolean extendReferenced) build a MIME package that contains all references in all FileSpecs of a given JDFDoc the doc is modified so that all URLs are cidsvoidbuild an empty MIME packagegets an input svoidupdateMultipart(InputStream is, String cid, String contentType) javax.mail.BodyPartupdateXMLMultipart(XMLDoc xmlDoc, String cid) voidwrite myself to a streamvoidwriteToDir(File directory) write a Message to a directorywriteToFile(String fileName) write a Multipart to an output filewriteToQueue(JDFDoc docJMF, JDFDoc docJDF, String strUrl) Deprecated.writeToQueue(JDFDoc docJMF, JDFDoc docJDF, String strUrl, boolean extendRef) submit a multipart file to a queuevoidwriteToStream(OutputStream outStream) write a Multipart to a StreamwriteToURL(String strUrl) write a Multipart to an output URL File: and http: are currently supported Use HttpURLConnection.getInputStream() to retrieve the http responseMethods inherited from class org.cip4.jdflib.util.mime.MimeHelper
getBodyPartHelper, getBodyParts, getCount, getCreatePartByCID, getCreatePartByLocalName, getMarkSize, getMultiPart, getPartByCID, getPartHelperByAttribute, getPartHelperByCID, getPartHelperByLocalName, setMarkSize
-
Field Details
-
log
protected static final org.apache.commons.logging.Log log
-
-
Constructor Details
-
MimeWriter
public MimeWriter() -
MimeWriter
-
MimeWriter
public MimeWriter(javax.mail.Multipart mp) - Parameters:
mp-
-
-
Method Details
-
setMIMEDetails
- Parameters:
_md-
-
getInputStream
gets an input s- Returns:
- Throws:
IOExceptionjavax.mail.MessagingException
-
createMimePackage
public void createMimePackage()build an empty MIME package -
updateMultipart
- Parameters:
is-cid-contentType-- Returns:
-
updateXMLMultipart
- Parameters:
xmlDoc-cid-- Returns:
-
writeToFile
write a Multipart to an output file- Parameters:
fileName- the file name- Returns:
-
writeToDir
write a Message to a directory- Parameters:
directory- the directory to use as '.' for writing the mime parts- Throws:
javax.mail.MessagingExceptionIOExceptionjavax.mail.MessagingException
-
writeToStream
write a Multipart to a Stream- Parameters:
outStream- the existing output stream, note that a buffered output stream is created in case outStream is unbuffered- Throws:
IOExceptionjavax.mail.MessagingException
-
writeToURL
write a Multipart to an output URL File: and http: are currently supported Use HttpURLConnection.getInputStream() to retrieve the http response- Parameters:
strUrl- the URL to write to- Returns:
HttpURLConnectionthe opened http connection, null in case of error or file- Throws:
IOExceptionjavax.mail.MessagingException
-
buildMimePackage
Builds a MIME package.- Parameters:
vXMLDocs- the Vector of XMLDoc representing the JMF and JDFs to be stored as the first part of the package t
-
buildMimePackage
build a MIME package that contains all references in all FileSpecs of a given JDFDoc the doc is modified so that all URLs are cids- Parameters:
docJMF- the JDFDoc representation of the JMF that references the jdf to package, if null only the jdf is packaged note that the URL of docJDF must already be specified as a CIDdocJDF- the JDFDoc representation of the JDF to packageextendReferenced- if true, also package any further reeferenced files
-
addBodyPart
- Parameters:
bph-
-
writeToQueue
@Deprecated public JDFDoc writeToQueue(JDFDoc docJMF, JDFDoc docJDF, String strUrl) throws IOException, javax.mail.MessagingException Deprecated.UsewriteToQueue(JDFDoc,JDFDoc,String,boolean)insteadsubmit a multipart file to a queue- Parameters:
docJMF- the jmf document containing the submitqueueentry or resubmitqueueentrydocJDF- the jdf to submitstrUrl- the url to submit to- Returns:
- Throws:
IOExceptionjavax.mail.MessagingException
-
writeToQueue
public JDFDoc writeToQueue(JDFDoc docJMF, JDFDoc docJDF, String strUrl, boolean extendRef) throws IOException, javax.mail.MessagingException submit a multipart file to a queue- Parameters:
docJMF- the jmf document containing the submitqueueentry or resubmitqueueentrydocJDF- the jdf to submitstrUrl- the url to submit toextendRef- TODO- Returns:
- Throws:
IOExceptionjavax.mail.MessagingException
-
writeStream
Description copied from interface:IStreamWriterwrite myself to a stream- Specified by:
writeStreamin interfaceIStreamWriter- Parameters:
os- the output stream- Throws:
IOException- if io snafu...
-
writeToQueue(JDFDoc,JDFDoc,String,boolean)instead