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
public class MimeWriter extends MimeHelper implements IStreamWriter
class to create and write mime files
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMimeWriter.eMimeSubType
-
Field Summary
Fields Modifier and Type Field Description protected static org.apache.commons.logging.Loglog-
Fields inherited from class org.cip4.jdflib.util.mime.MimeHelper
markSize, theMultipart
-
-
Constructor Summary
Constructors Constructor Description MimeWriter()MimeWriter(javax.mail.Multipart mp)MimeWriter(MimeWriter.eMimeSubType subtype)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddBodyPart(BodyPartHelper bph)voidbuildMimePackage(java.util.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 cidsvoidcreateMimePackage()build an empty MIME packagejava.io.InputStreamgetInputStream()gets an input svoidsetMIMEDetails(MimeUtil.MIMEDetails _md)BodyPartHelperupdateMultipart(java.io.InputStream is, java.lang.String cid, java.lang.String contentType)javax.mail.BodyPartupdateXMLMultipart(XMLDoc xmlDoc, java.lang.String cid)voidwriteStream(java.io.OutputStream os)write myself to a streamvoidwriteToDir(java.io.File directory)write a Message to a directoryjava.io.FilewriteToFile(java.lang.String fileName)write a Multipart to an output fileJDFDocwriteToQueue(JDFDoc docJMF, JDFDoc docJDF, java.lang.String strUrl)Deprecated.UsewriteToQueue(JDFDoc,JDFDoc,String,boolean)insteadJDFDocwriteToQueue(JDFDoc docJMF, JDFDoc docJDF, java.lang.String strUrl, boolean extendRef)submit a multipart file to a queuevoidwriteToStream(java.io.OutputStream outStream)write a Multipart to a StreamUrlPartwriteToURL(java.lang.String strUrl)write a Multipart to an output URL File: and http: are currently supported Use HttpURLConnection.getInputStream() to retrieve the http response-
Methods inherited from class org.cip4.jdflib.util.mime.MimeHelper
getBodyPartHelper, getBodyParts, getCount, getCreatePartByCID, getCreatePartByLocalName, getMarkSize, getMultiPart, getPartByCID, getPartHelperByAttribute, getPartHelperByCID, getPartHelperByLocalName, setMarkSize
-
-
-
-
Constructor Detail
-
MimeWriter
public MimeWriter()
-
MimeWriter
public MimeWriter(MimeWriter.eMimeSubType subtype)
-
MimeWriter
public MimeWriter(javax.mail.Multipart mp)
- Parameters:
mp-
-
-
Method Detail
-
setMIMEDetails
public void setMIMEDetails(MimeUtil.MIMEDetails _md)
- Parameters:
_md-
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException, javax.mail.MessagingExceptiongets an input s- Returns:
- Throws:
java.io.IOExceptionjavax.mail.MessagingException
-
createMimePackage
public void createMimePackage()
build an empty MIME package
-
updateMultipart
public BodyPartHelper updateMultipart(java.io.InputStream is, java.lang.String cid, java.lang.String contentType)
- Parameters:
is-cid-contentType-- Returns:
-
updateXMLMultipart
public javax.mail.BodyPart updateXMLMultipart(XMLDoc xmlDoc, java.lang.String cid)
- Parameters:
xmlDoc-cid-- Returns:
-
writeToFile
public java.io.File writeToFile(java.lang.String fileName)
write a Multipart to an output file- Parameters:
fileName- the file name- Returns:
-
writeToDir
public void writeToDir(java.io.File directory) throws javax.mail.MessagingException, java.io.IOExceptionwrite a Message to a directory- Parameters:
directory- the directory to use as '.' for writing the mime parts- Throws:
javax.mail.MessagingExceptionjava.io.IOExceptionjavax.mail.MessagingException
-
writeToStream
public void writeToStream(java.io.OutputStream outStream) throws java.io.IOException, javax.mail.MessagingExceptionwrite 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:
java.io.IOExceptionjavax.mail.MessagingException
-
writeToURL
public UrlPart writeToURL(java.lang.String strUrl) throws java.io.IOException, javax.mail.MessagingException
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:
java.io.IOExceptionjavax.mail.MessagingException
-
buildMimePackage
public void buildMimePackage(java.util.Vector<? extends XMLDoc> vXMLDocs)
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
public void buildMimePackage(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 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
public void addBodyPart(BodyPartHelper bph)
- Parameters:
bph-
-
writeToQueue
@Deprecated public JDFDoc writeToQueue(JDFDoc docJMF, JDFDoc docJDF, java.lang.String strUrl) throws java.io.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:
java.io.IOExceptionjavax.mail.MessagingException
-
writeToQueue
public JDFDoc writeToQueue(JDFDoc docJMF, JDFDoc docJDF, java.lang.String strUrl, boolean extendRef) throws java.io.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:
java.io.IOExceptionjavax.mail.MessagingException
-
writeStream
public void writeStream(java.io.OutputStream os) throws java.io.IOExceptionDescription copied from interface:IStreamWriterwrite myself to a stream- Specified by:
writeStreamin interfaceIStreamWriter- Parameters:
os- the output stream- Throws:
java.io.IOException- if io snafu...
-
-