Class ZipExtensions

java.lang.Object
io.github.astrapi69.zip.ZipExtensions

public final class ZipExtensions extends Object
The class ZipExtensions provides functionality for ziping and unzipping files.
  • Method Details

    • extractZipEntry

      public static void extractZipEntry(ZipFile zipFile, ZipEntry target, File toDirectory) throws IOException
      Extract zip entry.
      Parameters:
      zipFile - the zip file
      target - the target
      toDirectory - the to directory
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • isZip

      public static boolean isZip(String filename)
      Checks if the given filename is a zip-file.
      Parameters:
      filename - The filename to check.
      Returns:
      True if the filename is a zip-file otherwise false.
    • unzip

      public static void unzip(ZipFile zipFile, File toDir) throws IOException
      Unzip.
      Parameters:
      zipFile - the zip file
      toDir - the to dir
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • zip

      public static void zip(File fileToZip, File zipFile) throws FileNotFoundException, IOException, io.github.astrapi69.file.exception.FileDoesNotExistException
      Zip the given file.
      Parameters:
      fileToZip - the file to zip.
      zipFile - the zip file
      Throws:
      FileNotFoundException - is thrown if the given file is not found
      IOException - Signals that an I/O exception has occurred.
      io.github.astrapi69.file.exception.FileDoesNotExistException - the file does not exist exception
    • zip

      public static void zip(File dirToZip, File zipFile, FilenameFilter filter) throws FileNotFoundException, IOException, io.github.astrapi69.file.exception.FileDoesNotExistException
      Zip the given file.
      Parameters:
      dirToZip - the dir to zip
      zipFile - the zip file
      filter - the filter
      Throws:
      FileNotFoundException - is thrown if the given file is not found
      IOException - Signals that an I/O exception has occurred.
      io.github.astrapi69.file.exception.FileDoesNotExistException - the file does not exist exception
    • zip

      public static void zip(File dirToZip, File zipFile, FilenameFilter filter, boolean createFile) throws FileNotFoundException, IOException, io.github.astrapi69.file.exception.FileDoesNotExistException
      Zip the given file.
      Parameters:
      dirToZip - the dir to zip
      zipFile - the zip file
      filter - the filter
      createFile - the create file
      Throws:
      FileNotFoundException - is thrown if the given file is not found
      IOException - Signals that an I/O exception has occurred.
      io.github.astrapi69.file.exception.FileDoesNotExistException - the file does not exist exception
    • zipFiles

      public static void zipFiles(File file, File dirToZip, FileFilter... excludeFileFilter) throws IOException
      Zip files.
      Parameters:
      file - the file
      dirToZip - the dir to zip
      excludeFileFilter - the file filter for files to exclude
      Throws:
      IOException - Signals that an I/O exception has occurred.