Class ArchiveHelper

java.lang.Object
com.peterphi.std.io.ArchiveHelper

public class ArchiveHelper extends Object
  • Constructor Details

    • ArchiveHelper

      public ArchiveHelper()
  • Method Details

    • extractArchive

      public static boolean extractArchive(File tarFile, File extractTo)
      Extracts a .tar or .tar.gz archive to a given folder
      Parameters:
      tarFile - File The archive file
      extractTo - 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 IOException
      Adds a file or files to a jar file, replacing the original one
      Parameters:
      jarFile - File the jar file
      basePathWithinJar - String the base path to put the files within the Jar
      files - 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