Class TarGzArchiver


  • public class TarGzArchiver
    extends java.lang.Object
    Gzipped Tar archiver which preserves
    • POSIX file permissions
    • Symbolic links (if the link target points inside the archive)
    • Last modification timestamp
    in the archive as found in the filesystem for files to be archived. It uses GNU tar format extensions for archive entries with path length > 100.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.io.File destFile  
      private org.apache.maven.plugin.logging.Log log  
      private java.util.List<java.io.File> sourceDirs  
    • Constructor Summary

      Constructors 
      Constructor Description
      TarGzArchiver()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addDirectory​(java.io.File directory)  
      private void addToTarRecursively​(java.io.File tarRootDir, java.io.File source, org.apache.commons.compress.archivers.tar.TarArchiveOutputStream tarStream)  
      private static void copyFileContentToTarStream​(java.io.File source, org.apache.commons.compress.archivers.tar.TarArchiveOutputStream tarStream)  
      void createArchive()  
      private org.apache.commons.compress.archivers.tar.TarArchiveEntry createTarEntry​(java.io.File tarRootDir, java.io.File source)  
      private java.nio.file.attribute.PosixFileAttributes getAttributes​(java.io.File source)  
      private java.nio.file.Path getRelativeSymLinkTarget​(java.io.File source, java.io.File baseDir)  
      private static boolean isSymbolicLink​(java.io.File file)  
      private boolean resolvesBelow​(java.io.File source, java.io.File baseDir)  
      void setDestFile​(java.io.File destFile)  
      void setLog​(org.apache.maven.plugin.logging.Log log)  
      private static java.lang.String slashify​(java.nio.file.Path path)  
      private void validate()  
      • Methods inherited from class java.lang.Object

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

      • destFile

        private java.io.File destFile
      • sourceDirs

        private java.util.List<java.io.File> sourceDirs
      • log

        private org.apache.maven.plugin.logging.Log log
    • Constructor Detail

      • TarGzArchiver

        public TarGzArchiver()
    • Method Detail

      • setLog

        public void setLog​(org.apache.maven.plugin.logging.Log log)
      • setDestFile

        public void setDestFile​(java.io.File destFile)
      • addDirectory

        public void addDirectory​(java.io.File directory)
      • createArchive

        public void createArchive()
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • validate

        private void validate()
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • addToTarRecursively

        private void addToTarRecursively​(java.io.File tarRootDir,
                                         java.io.File source,
                                         org.apache.commons.compress.archivers.tar.TarArchiveOutputStream tarStream)
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • createTarEntry

        private org.apache.commons.compress.archivers.tar.TarArchiveEntry createTarEntry​(java.io.File tarRootDir,
                                                                                         java.io.File source)
                                                                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • slashify

        private static java.lang.String slashify​(java.nio.file.Path path)
      • getAttributes

        private java.nio.file.attribute.PosixFileAttributes getAttributes​(java.io.File source)
      • copyFileContentToTarStream

        private static void copyFileContentToTarStream​(java.io.File source,
                                                       org.apache.commons.compress.archivers.tar.TarArchiveOutputStream tarStream)
                                                throws java.io.IOException
        Throws:
        java.io.IOException
      • resolvesBelow

        private boolean resolvesBelow​(java.io.File source,
                                      java.io.File baseDir)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • getRelativeSymLinkTarget

        private java.nio.file.Path getRelativeSymLinkTarget​(java.io.File source,
                                                            java.io.File baseDir)
                                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • isSymbolicLink

        private static boolean isSymbolicLink​(java.io.File file)