org.cip4.jdflib.util.mime
Class MimeWriter

java.lang.Object
  extended by org.cip4.jdflib.util.mime.MimeHelper
      extended by org.cip4.jdflib.util.mime.MimeWriter

public class MimeWriter
extends MimeHelper

class to create and write mime files

Author:
Dr. Rainer Prosi, Heidelberger Druckmaschinen AG July 24, 2009

Field Summary
 
Fields inherited from class org.cip4.jdflib.util.mime.MimeHelper
markSize, theMultipart
 
Constructor Summary
MimeWriter()
           
MimeWriter(javax.mail.Multipart mp)
           
 
Method Summary
 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
 void buildMimePackage(Vector<? extends XMLDoc> vXMLDocs)
          Builds a MIME package.
 void createMimePackage()
          build an empty MIME package
 InputStream getInputStream()
          gets an input s
 void setMIMEDetails(MimeUtil.MIMEDetails _md)
           
 BodyPartHelper updateMultipart(InputStream is, String cid, String contentType)
           
 javax.mail.BodyPart updateXMLMultipart(XMLDoc xmlDoc, String cid)
           
 void writeToDir(File directory)
          write a Message to a directory
 File writeToFile(String fileName)
          write a Multipart to an output file
 JDFDoc writeToQueue(JDFDoc docJMF, JDFDoc docJDF, String strUrl)
          submit a multipart file to a queue
 void writeToStream(OutputStream outStream)
          write a Multipart to a Stream
 UrlPart writeToURL(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, getMarkSize, getMultiPart, getPartByCID, getPartHelperByCID, setMarkSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MimeWriter

public MimeWriter()

MimeWriter

public MimeWriter(javax.mail.Multipart mp)
Parameters:
mp -
Method Detail

setMIMEDetails

public void setMIMEDetails(MimeUtil.MIMEDetails _md)
Parameters:
_md -

getInputStream

public InputStream getInputStream()
                           throws IOException,
                                  javax.mail.MessagingException
gets an input s

Returns:
Throws:
IOException
javax.mail.MessagingException

createMimePackage

public void createMimePackage()
build an empty MIME package


updateMultipart

public BodyPartHelper updateMultipart(InputStream is,
                                      String cid,
                                      String contentType)
Parameters:
is -
cid -
contentType -
Returns:

updateXMLMultipart

public javax.mail.BodyPart updateXMLMultipart(XMLDoc xmlDoc,
                                              String cid)
Parameters:
xmlDoc -
cid -
Returns:

writeToFile

public File writeToFile(String fileName)
write a Multipart to an output file

Parameters:
fileName - the file name
Returns:

writeToDir

public void writeToDir(File directory)
                throws javax.mail.MessagingException,
                       IOException
write a Message to a directory

Parameters:
directory - the directory to use as '.' for writing the mime parts
Throws:
javax.mail.MessagingException
IOException
javax.mail.MessagingException

writeToStream

public void writeToStream(OutputStream outStream)
                   throws IOException,
                          javax.mail.MessagingException
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:
IOException
javax.mail.MessagingException

writeToURL

public UrlPart writeToURL(String strUrl)
                   throws 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:
HttpURLConnection the opened http connection, null in case of error or file
Throws:
IOException
javax.mail.MessagingException

buildMimePackage

public void buildMimePackage(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 CID
docJDF - the JDFDoc representation of the JDF to package
extendReferenced - if true, also package any further reeferenced files

writeToQueue

public JDFDoc writeToQueue(JDFDoc docJMF,
                           JDFDoc docJDF,
                           String strUrl)
                    throws IOException,
                           javax.mail.MessagingException
submit a multipart file to a queue

Parameters:
docJMF - the jmf document containing the submitqueueentry or resubmitqueueentry
docJDF - the jdf to submit
strUrl - the url to submit to
Returns:
Throws:
IOException
javax.mail.MessagingException


Copyright © 2013. All Rights Reserved.