Class ArchiveWriter


  • public class ArchiveWriter
    extends Object
    The feature archive writer can be used to create an archive based on a feature model. The archive contains the feature model file and all artifacts using a maven repository layout.
    • Field Detail

      • VERSION_HEADER

        public static final String VERSION_HEADER
        The manifest header marking an archive as a feature archive.
        See Also:
        Constant Field Values
      • CONTENTS_HEADER

        public static final String CONTENTS_HEADER
        The manifest header listing the features in this archive.
        See Also:
        Constant Field Values
      • ARCHIVE_VERSION

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

      • ArchiveWriter

        public ArchiveWriter()
    • Method Detail

      • write

        public static JarOutputStream write​(OutputStream out,
                                            Manifest baseManifest,
                                            ArtifactProvider provider,
                                            Feature... features)
                                     throws IOException
        Create a feature model archive. The output stream will not be closed by this method. The caller must call ZipOutputStream.close() on the return output stream. The caller can add additional files through the return stream. However, the files should not be compressed (which is the default for the output stream). A feature model can be in different states: it might be a partial feature model, a complete feature model or an assembled feature model. This method takes the feature model as provided and only writes the listed bundles and artifacts of this feature model into the archive. In general, the best approach for sharing features is to archive complete features.
        Parameters:
        out - The output stream to write to
        baseManifest - Optional base manifest used for creating the manifest.
        provider - The artifact provider
        features - The features model to archive
        Returns:
        The jar output stream.
        Throws:
        IOException - If anything goes wrong