Package com.peterphi.std.io
Class ArchiveHelper
java.lang.Object
com.peterphi.std.io.ArchiveHelper
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
addFilesToExistingJar
(File jarFile, String basePathWithinJar, Map<String, File> files, ActionOnConflict action) Adds a file or files to a jar file, replacing the original onestatic boolean
extractArchive
(File tarFile, File extractTo) Extracts a .tar or .tar.gz archive to a given folder
-
Constructor Details
-
ArchiveHelper
public ArchiveHelper()
-
-
Method Details
-
extractArchive
Extracts a .tar or .tar.gz archive to a given folder- Parameters:
tarFile
- File The archive fileextractTo
- File The folder to extract the contents of this archive to- Returns:
- boolean True if the archive was successfully extracted, otherwise false
-
addFilesToExistingJar
public static boolean addFilesToExistingJar(File jarFile, String basePathWithinJar, Map<String, File> files, ActionOnConflict action) throws IOExceptionAdds a file or files to a jar file, replacing the original one- Parameters:
jarFile
- File the jar filebasePathWithinJar
- String the base path to put the files within the Jarfiles
- File[] The files. The files will be placed in basePathWithinJar- Throws:
Exception
IOException
- Since:
- 2007-06-07 uses createTempFile instead of Java's createTempFile, increased buffer from 1k to 4k
-