Package net.simplace.core.service
Klasse TARHelper
java.lang.Object
net.simplace.core.service.TARHelper
All the tar operations are handled.
- Autor:
- Andreas Enders
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic voidAdd a file(s) to the zip file from a collection of files.static voidaddToTar(Collection<File> aFilesCollection, File aSourceTarFile, File aDestinationTarFile) Add a file(s) to the zip file from a collection of files.static voidcreateTar(String aFileName, InputStream aInputStream, File aDestinationFile, boolean doGZIP) Creates a zip file out of a InputStream.static voidcreateTar(Collection<File> aFilesCollection, File aDestinationFile, boolean doGZIP) Creates a zip file out of a collection of files.static voidcreateTARWithPathEntries(File aDirectory, File aTarFile, boolean doGZIP) Packs the given directory into a new zipfile with the given namestatic voidcreateTARWithPathEntries(Collection<File> aFilesCollection, File aDestinationFile, String aParentStartPath, boolean doGZIP) Creates a zip file out of a collection of files.static chargetFileSeparator(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 FilePacks the given directory into a new zipfile with the given namestatic FilePacks the given directory into a new zipfile with the given namestatic FilePacks the given directory into a new zipfile with the given namestatic FilePacks the given directory into a new zipfile with the given namestatic final booleanpackAndDeleteDirContents(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 booleanpackDirContents(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 FilePacks the given directory into a new zipfile with the given namestatic FilePacks the given directory into a new zipfile with the given namestatic FilePacks the given directory into a new zipfile with the given namestatic FilePacks the given directory into a new zipfile with the given nameUnTars a Tar file to the given directory and returns a map of unTarped-filesUnzips a zip file to the given directory and returns a map of unzipped-files.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.Unzips a zip file to the given directory and returns a map of unzipped-filesstatic voidunTarWithPath(File aSourceTarFile, String aDestinationDir, boolean doUnGZIP) Unzips a zip file to the given directory structure as how the zipentry specifies.
-
Methodendetails
-
gz
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
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
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
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
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
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
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
-