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
  • Field Details

    • log

      protected static final org.apache.commons.logging.Log log
  • Constructor Details

    • MimeWriter

      public MimeWriter()
    • MimeWriter

      public MimeWriter(MimeWriter.eMimeSubType subtype)
    • MimeWriter

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

    • 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
    • addBodyPart

      public void addBodyPart(BodyPartHelper bph)
      Parameters:
      bph -
    • writeToQueue

      @Deprecated 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
    • 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 resubmitqueueentry
      docJDF - the jdf to submit
      strUrl - the url to submit to
      extendRef - TODO
      Returns:
      Throws:
      IOException
      javax.mail.MessagingException
    • writeStream

      public void writeStream(OutputStream os) throws IOException
      Description copied from interface: IStreamWriter
      write myself to a stream
      Specified by:
      writeStream in interface IStreamWriter
      Parameters:
      os - the output stream
      Throws:
      IOException - if io snafu...