Class ModelArchiveWriter


  • public class ModelArchiveWriter
    extends java.lang.Object
    The model archive writer can be used to create an archive based on a model The archive contains the model file and all artifacts.
    Since:
    1.3
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int ARCHIVE_VERSION
      Current support version of the model archive.
      static java.lang.String ARTIFACTS_PREFIX
      Artifacts prefix.
      static java.lang.String DEFAULT_EXTENSION
      Default extension for model archives.
      static java.lang.String MANIFEST_HEADER
      The manifest header marking an archive as a model archive.
      static java.lang.String MODEL_NAME
      Model name.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.jar.JarOutputStream write​(java.io.OutputStream out, Model model, java.util.jar.Manifest baseManifest, ModelArchiveWriter.ArtifactProvider provider)
      Create a model archive.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MANIFEST_HEADER

        public static final java.lang.String MANIFEST_HEADER
        The manifest header marking an archive as a model archive.
        See Also:
        Constant Field Values
      • ARCHIVE_VERSION

        public static final int ARCHIVE_VERSION
        Current support version of the model archive.
        See Also:
        Constant Field Values
      • DEFAULT_EXTENSION

        public static final java.lang.String DEFAULT_EXTENSION
        Default extension for model archives.
        See Also:
        Constant Field Values
      • MODEL_NAME

        public static final java.lang.String MODEL_NAME
        Model name.
        See Also:
        Constant Field Values
      • ARTIFACTS_PREFIX

        public static final java.lang.String ARTIFACTS_PREFIX
        Artifacts prefix.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ModelArchiveWriter

        public ModelArchiveWriter()
    • Method Detail

      • write

        public static java.util.jar.JarOutputStream write​(java.io.OutputStream out,
                                                          Model model,
                                                          java.util.jar.Manifest baseManifest,
                                                          ModelArchiveWriter.ArtifactProvider provider)
                                                   throws java.io.IOException
        Create a model archive. The output stream will not be closed by this method. The caller must call ZipOutputStream.close() or ZipOutputStream.finish() on the return output stream. The caller can add additional files through the return stream. In order to create an archive for a model, each feature in the model must have a name and a version and the model must be valid, therefore ModelUtility.validateIncludingVersion(Model) is called first. If the model is invalid an IOException is thrown.
        Parameters:
        out - The output stream to write to
        model - The model to write
        baseManifest - Optional base manifest used for creating the manifest.
        provider - The artifact provider
        Returns:
        The jar output stream.
        Throws:
        java.io.IOException - If anything goes wrong