Klasse TARHelper

java.lang.Object
net.simplace.core.service.TARHelper

public final class TARHelper extends Object
All the tar operations are handled.
Autor:
Andreas Enders
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    static void
    addToTar(File aFileToAdd, File aSourceZipFile, File aDestinationZipFile)
    Add a file(s) to the zip file from a collection of files.
    static void
    addToTar(Collection<File> aFilesCollection, File aSourceTarFile, File aDestinationTarFile)
    Add a file(s) to the zip file from a collection of files.
    static void
    createTar(String aFileName, InputStream aInputStream, File aDestinationFile, boolean doGZIP)
    Creates a zip file out of a InputStream.
    static void
    createTar(Collection<File> aFilesCollection, File aDestinationFile, boolean doGZIP)
    Creates a zip file out of a collection of files.
    static void
    createTARWithPathEntries(File aDirectory, File aTarFile, boolean doGZIP)
    Packs the given directory into a new zipfile with the given name
    static void
    createTARWithPathEntries(Collection<File> aFilesCollection, File aDestinationFile, String aParentStartPath, boolean doGZIP)
    Creates a zip file out of a collection of files.
    static char
    getFileSeparator(File aZipArchive)
    Parses the Entries of the given Zip archive and looks for the file separator character, if it is a directory.
    static Collection<com.ice.tar.TarEntry>
    getTAREntries(File aSourceTarFile, boolean doUnGZIP)
    Extracts the entries of the given zip-file.
    static File
    gz(File aSourceFile)
    Packs the given directory into a new zipfile with the given name
    static File
    gz(File aSourceFile, boolean doDeletSourceFile)
    Packs the given directory into a new zipfile with the given name
    static File
    gz(File aSourceFile, File aDestFile)
    Packs the given directory into a new zipfile with the given name
    static File
    gz(File aSourceFile, File aDestFile, boolean doDeletSourceFile)
    Packs the given directory into a new zipfile with the given name
    static final boolean
    packAndDeleteDirContents(File aTarFile, File aDir, String aExtension, long aOlderThanMillis, boolean doGZIP)
    Deletes all the files in a directory excluding the subdirectories files, if the given file is a directory but does not delete the directory itself.
    static final boolean
    packDirContents(File aTarFile, File aDir, String aExtension, long aOlderThanMillis, boolean doGZIP)
    Deletes all the files in a directory excluding the subdirectories files, if the given file is a directory but does not delete the directory itself.
    static File
    ungz(File aSourceFile)
    Packs the given directory into a new zipfile with the given name
    static File
    ungz(File aSourceFile, boolean doDeleteSourceFile)
    Packs the given directory into a new zipfile with the given name
    static File
    ungz(File aSourceFile, File aDestFile)
    Packs the given directory into a new zipfile with the given name
    static File
    ungz(File aSourceFile, File aDestFile, boolean doDeleteSourceFile)
    Packs the given directory into a new zipfile with the given name
    static List<File>
    unTar(File aSourceTarFile, String aDestinationDir, boolean aReplacePercentInPath, boolean doUnGZIP)
    UnTars a Tar file to the given directory and returns a map of unTarped-files
    static List<File>
    unTar(File aSourceTarFile, String aSubPath, String aDestinationDir, boolean doUnGZIP)
    Unzips a zip file to the given directory and returns a map of unzipped-files.
    static List<File>
    unTar(File aSourceTarFile, String aSubPath, String aDestinationDir, boolean aReplacePercentInPath, boolean doUnGZIP)
    Unzips a zip file to the given directory and returns a map of unzipped-files.
    static List<File>
    unTAR(File aSourceTarFile, String aDestinationDir, boolean doUnGZIP)
    Unzips a zip file to the given directory and returns a map of unzipped-files
    static void
    unTarWithPath(File aSourceTarFile, String aDestinationDir, boolean doUnGZIP)
    Unzips a zip file to the given directory structure as how the zipentry specifies.

    Von Klasse geerbte Methoden java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Methodendetails

    • gz

      public static File gz(File aSourceFile) throws ZipException
      Packs the given directory into a new zipfile with the given name
      Parameter:
      aSourceFile -
      Gibt zurück:
      a new zipfile with the given name
      Löst aus:
      ZipException
    • gz

      public static File gz(File aSourceFile, boolean doDeletSourceFile) throws ZipException
      Packs the given directory into a new zipfile with the given name
      Parameter:
      aSourceFile -
      doDeletSourceFile -
      Gibt zurück:
      a new zipfile with the given name
      Löst aus:
      ZipException
    • gz

      public static File gz(File aSourceFile, File aDestFile) throws ZipException
      Packs the given directory into a new zipfile with the given name
      Parameter:
      aSourceFile -
      aDestFile -
      Gibt zurück:
      a new zipfile with the given name
      Löst aus:
      ZipException
    • gz

      public static File gz(File aSourceFile, File aDestFile, boolean doDeletSourceFile) throws ZipException
      Packs the given directory into a new zipfile with the given name
      Parameter:
      aSourceFile -
      aDestFile -
      doDeletSourceFile -
      Gibt zurück:
      a new zipfile with the given name
      Löst aus:
      ZipException
    • ungz

      public static File ungz(File aSourceFile) throws ZipException
      Packs the given directory into a new zipfile with the given name
      Parameter:
      aSourceFile -
      aDestFile -
      Gibt zurück:
      a new zipfile with the given name
      Löst aus:
      ZipException
    • ungz

      public static File ungz(File aSourceFile, boolean doDeleteSourceFile) throws ZipException
      Packs the given directory into a new zipfile with the given name
      Parameter:
      aSourceFile -
      doDeleteSourceFile -
      aDestFile -
      Gibt zurück:
      a new zipfile with the given name
      Löst aus:
      ZipException
    • ungz

      public static File ungz(File aSourceFile, File aDestFile) throws ZipException
      Packs the given directory into a new zipfile with the given name
      Parameter:
      aSourceFile -
      aDestFile -
      Gibt zurück:
      a new zipfile with the given name
      Löst aus:
      ZipException
    • ungz

      public static File ungz(File aSourceFile, File aDestFile, boolean doDeleteSourceFile) throws ZipException
      Packs the given directory into a new zipfile with the given name
      Parameter:
      aSourceFile -
      aDestFile -
      doDeleteSourceFile -
      Gibt zurück:
      a new zipfile with the given name
      Löst aus:
      ZipException
    • createTARWithPathEntries

      public static void createTARWithPathEntries(File aDirectory, File aTarFile, boolean doGZIP) throws ZipException
      Packs the given directory into a new zipfile with the given name
      Parameter:
      aDirectory -
      aTarFile -
      doGZIP -
      Löst aus:
      ZipException
    • createTARWithPathEntries

      public static void createTARWithPathEntries(Collection<File> aFilesCollection, File aDestinationFile, String aParentStartPath, boolean doGZIP) throws ZipException
      Creates a zip file out of a collection of files. The zip file created will have the path information of each file so that when it is unzipped then it is copied into the specific directory format. The relative path name is also given as parameter. Also fecilitates with the feature of adding empty directory entries. (i.e if the list of files contains a directory then it is added as a directory zipentry.) *
      Parameter:
      aFilesCollection -
      aDestinationFile -
      aParentStartPath -
      doGZIP -
      Löst aus:
      ZipException
    • unTarWithPath

      public static void unTarWithPath(File aSourceTarFile, String aDestinationDir, boolean doUnGZIP) throws ZipException
      Unzips a zip file to the given directory structure as how the zipentry specifies. If a directory zip entry exists then a empty directory with the entry name is created.
      Parameter:
      aSourceTarFile -
      aDestinationDir -
      doUnGZIP -
      Löst aus:
      ZipException
    • packAndDeleteDirContents

      public static final boolean packAndDeleteDirContents(File aTarFile, File aDir, String aExtension, long aOlderThanMillis, boolean doGZIP)
      Deletes all the files in a directory excluding the subdirectories files, if the given file is a directory but does not delete the directory itself. Before it Zips the given Files to another place.
      Parameter:
      aTarFile -
      aDir -
      aExtension -
      aOlderThanMillis -
      doGZIP -
      Gibt zurück:
      success
    • packDirContents

      public static final boolean packDirContents(File aTarFile, File aDir, String aExtension, long aOlderThanMillis, boolean doGZIP)
      Deletes all the files in a directory excluding the subdirectories files, if the given file is a directory but does not delete the directory itself. Before it Zips the given Files to another place.
      Parameter:
      aTarFile -
      aDir -
      aExtension -
      aOlderThanMillis -
      doGZIP -
      Gibt zurück:
      success
    • createTar

      public static void createTar(Collection<File> aFilesCollection, File aDestinationFile, boolean doGZIP) throws ZipException
      Creates a zip file out of a collection of files.
      Parameter:
      aFilesCollection -
      aDestinationFile -
      doGZIP -
      Löst aus:
      ZipException
    • createTar

      public static void createTar(String aFileName, InputStream aInputStream, File aDestinationFile, boolean doGZIP) throws ZipException
      Creates a zip file out of a InputStream.
      Parameter:
      aFileName -
      aInputStream -
      aDestinationFile -
      doGZIP -
      Löst aus:
      ZipException
    • addToTar

      public static void addToTar(Collection<File> aFilesCollection, File aSourceTarFile, File aDestinationTarFile) throws ZipException
      Add a file(s) to the zip file from a collection of files.
      Parameter:
      aFilesCollection -
      aSourceTarFile -
      aDestinationTarFile -
      Löst aus:
      ZipException
    • addToTar

      public static void addToTar(File aFileToAdd, File aSourceZipFile, File aDestinationZipFile) throws ZipException
      Add a file(s) to the zip file from a collection of files.
      Parameter:
      aFileToAdd -
      aSourceZipFile -
      aDestinationZipFile -
      Löst aus:
      ZipException
    • unTAR

      public static List<File> unTAR(File aSourceTarFile, String aDestinationDir, boolean doUnGZIP) throws ZipException
      Unzips a zip file to the given directory and returns a map of unzipped-files
      Parameter:
      aSourceTarFile -
      aDestinationDir -
      doUnGZIP -
      Gibt zurück:
      a list of unzipped-files
      Löst aus:
      ZipException
    • unTar

      public static List<File> unTar(File aSourceTarFile, String aDestinationDir, boolean aReplacePercentInPath, boolean doUnGZIP) throws ZipException
      UnTars a Tar file to the given directory and returns a map of unTarped-files
      Parameter:
      aSourceTarFile -
      aDestinationDir -
      aReplacePercentInPath -
      doUnGZIP -
      Gibt zurück:
      a list of unTarped-files
      Löst aus:
      ZipException
    • unTar

      public static List<File> unTar(File aSourceTarFile, String aSubPath, String aDestinationDir, boolean doUnGZIP) throws ZipException
      Unzips a zip file to the given directory and returns a map of unzipped-files. Will only unzip files with the given subPath.
      Parameter:
      aSourceTarFile -
      aSubPath -
      aDestinationDir -
      doUnGZIP -
      Gibt zurück:
      a list of unzipped-files
      Löst aus:
      ZipException
    • unTar

      public static List<File> unTar(File aSourceTarFile, String aSubPath, String aDestinationDir, boolean aReplacePercentInPath, boolean doUnGZIP) throws ZipException
      Unzips a zip file to the given directory and returns a map of unzipped-files. Will only unzip files with the given subPath.
      Parameter:
      aSourceTarFile -
      aSubPath -
      aDestinationDir -
      aReplacePercentInPath -
      doUnGZIP -
      Gibt zurück:
      a list of unzipped-files
      Löst aus:
      ZipException
    • getTAREntries

      public static Collection<com.ice.tar.TarEntry> getTAREntries(File aSourceTarFile, boolean doUnGZIP) throws ZipException
      Extracts the entries of the given zip-file.
      Parameter:
      aSourceTarFile -
      doUnGZIP -
      Gibt zurück:
      the entries of the given zip-file
      Löst aus:
      ZipException
    • getFileSeparator

      public static char getFileSeparator(File aZipArchive)
      Parses the Entries of the given Zip archive and looks for the file separator character, if it is a directory. This method is useful as you don't know if the ZipArchive was packed on a Linux or on a Windows system. Both operating systems use different file separators when creating a zip archive. if it should be unzipped on the other OS, this might lead to errors.
      Parameter:
      aZipArchive -
      Gibt zurück:
      file separator