Interface Archiver


  • @Internal
    public interface Archiver

    An archiver is an object capable of creating archive files and extracting their content. Each archiver should be capable of handling at least one type of archive, e.g. zip or gz.

    • Method Detail

      • compressFiles

        void compressFiles​(@NotNull
                           @NotNull Iterable<File> sourceFiles,
                           @NotNull
                           @NotNull File archiveFile,
                           @Nullable
                           @Nullable File baseDirectory)
                    throws IOException
        Compresses multiple files into a single archive.
        Parameters:
        sourceFiles - Files to archive. Each file will exist. If baseDirectory argument is given, all files will be contained within that directory.
        archiveFile - Archive file to create. Will not exist.
        baseDirectory - Optional argument: base directory of all the files to compress. If given, all file paths in the resulting archive should be calculated relatively to this directory. If skipped, all source files should be placed in the archive root. If the argument is present, the file will exist and will be a directory.
        Throws:
        IOException - if any IO operation fails
      • extractArchive

        void extractArchive​(@NotNull
                            @NotNull File archiveFile,
                            @NotNull
                            @NotNull File destinationDirectory)
                     throws IOException
        Extracts an archive contents into the provided destination directory.
        Parameters:
        archiveFile - Archive file. Will exists.
        destinationDirectory - Directory to which the content of the archive should be copied. This file will exist and will be a directory.
        Throws:
        IOException - if any IO operation fails
      • getArchiveFileExtensions

        @NotNull
        @NotNull List<String> getArchiveFileExtensions()
        Return a list of legal archive file extensions for archive type handled by this archiver. This method must return a list of at least one element. The first returned extension will be treated as "default" or "preferable".
        Returns:
        a list of valid file extensions for archive type handled by this archiver