Class Zip

  • All Implemented Interfaces:
    IVilType

    public class Zip
    extends java.lang.Object
    implements IVilType
    Creates ZIP files.
    Author:
    Holger Eichelberger
    • Constructor Detail

      • Zip

        public Zip()
    • Method Detail

      • zip

        public static Set<FileArtifact> zip​(Path base,
                                            Path artifacts,
                                            Path zip)
                                     throws VilException
        Packs source files into target.
        Parameters:
        base - the base path used to make the paths of the artifacts relative, may be the source or target project
        artifacts - the artifacts to be handled
        zip - the target zip file
        Returns:
        the created artifacts
        Throws:
        VilException - in case that processing the JAR file fails for some reason
      • zip

        public static Set<FileArtifact> zip​(Path base,
                                            Collection<FileArtifact> artifacts,
                                            Path zip)
                                     throws VilException
        Packs source files into target.
        Parameters:
        base - the base path used to make the paths of the artifacts relative, may be the source or target project
        artifacts - the artifacts to be handled
        zip - the target zip file
        Returns:
        the created artifacts
        Throws:
        VilException - in case that processing the JAR file fails for some reason
      • add

        public static Set<FileArtifact> add​(Path base,
                                            Collection<FileArtifact> artifacts,
                                            Path target,
                                            ZipHandler handler)
                                     throws VilException
        Packs source files into target using handler.
        Parameters:
        base - the base path used to make the paths of the artifacts relative, may be the source or target project
        artifacts - the artifacts to be handled
        target - the target ZIP/JAR file
        handler - the actual ZIP handler
        Returns:
        the created artifacts
        Throws:
        VilException - in case that processing the JAR file fails for some reason
      • toFileList

        public static final java.util.List<java.io.File> toFileList​(Collection<FileArtifact> artifacts)
        Turns a collection of file artifacts into files.
        Parameters:
        artifacts - the artifacts to be processed
        Returns:
        the corresponding files
      • toFileArtifactSet

        public static final Set<FileArtifact> toFileArtifactSet​(java.util.List<java.io.File> files,
                                                                ArtifactModel model)
                                                         throws VilException
        Turns a list of files into related file artifacts.
        Parameters:
        files - the files to be turned into file artifacts
        model - the artifact model to be used (may be null for auto-detection)s
        Returns:
        the set of file artifacts
        Throws:
        VilException - if creating a file artifact instance fails