Class SevenZFileExtensions

java.lang.Object
io.github.astrapi69.zip.sevenz.SevenZFileExtensions

public class SevenZFileExtensions extends Object
Utility class for handling 7z (7-Zip) file compression and decompression.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    extract(File sevenZipFile, File destination)
    Extracts the contents of a 7z archive to the specified destination directory.
    static void
    extract(File sevenZipFile, File destination, char[] password)
    Extracts the contents of a 7z archive to the specified destination directory.
    static void
    zipFiles(File sevenZipFile, File... files)
    Compresses the given files into a 7z archive.
    static void
    zipFiles(File sevenZipFile, String dirToZip, File... files)
    Compresses the given files into a 7z archive.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SevenZFileExtensions

      public SevenZFileExtensions()
  • Method Details

    • zipFiles

      public static void zipFiles(File sevenZipFile, String dirToZip, File... files) throws IOException
      Compresses the given files into a 7z archive.
      Parameters:
      sevenZipFile - The destination 7z file.
      dirToZip - The directory to be zipped.
      files - The files to be included in the 7z archive.
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • zipFiles

      public static void zipFiles(File sevenZipFile, File... files) throws IOException
      Compresses the given files into a 7z archive.
      Parameters:
      sevenZipFile - The destination 7z file.
      files - The files to be included in the 7z archive.
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • extract

      public static void extract(File sevenZipFile, File destination, char[] password) throws IOException
      Extracts the contents of a 7z archive to the specified destination directory.
      Parameters:
      sevenZipFile - The source 7z file.
      destination - The destination directory.
      password - The password for encrypted 7z files.
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • extract

      public static void extract(File sevenZipFile, File destination) throws IOException
      Extracts the contents of a 7z archive to the specified destination directory.
      Parameters:
      sevenZipFile - The source 7z file.
      destination - The destination directory.
      Throws:
      IOException - Signals that an I/O exception has occurred.