Package io.github.astrapi69.file.zip
Class Zip4jExtensions
- java.lang.Object
-
- io.github.astrapi69.file.zip.Zip4jExtensions
-
public final class Zip4jExtensions extends java.lang.Object
The classZip4jExtensions
.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
extract(net.lingala.zip4j.ZipFile zipFile4j, java.io.File destination, java.lang.String password)
Extract.static net.lingala.zip4j.model.ZipParameters
newZipParameters(net.lingala.zip4j.model.enums.CompressionMethod compressionMethod, net.lingala.zip4j.model.enums.CompressionLevel compressionLevel)
Factory method for create a newZipParameters
from the given parametersstatic void
zipFiles(net.lingala.zip4j.ZipFile zipFile4j, java.io.File... toAdd)
Adds a file or several files to the given zip file with the parameters Zip4jConstants.COMP_DEFLATE for the compression method and Zip4jConstants.DEFLATE_LEVEL_NORMAL as the compression level.static void
zipFiles(net.lingala.zip4j.ZipFile zipFile4j, net.lingala.zip4j.model.enums.CompressionMethod compressionMethod, net.lingala.zip4j.model.enums.CompressionLevel compressionLevel, java.io.File... toAdd)
Adds a file or several files to the given zip file with the given parameters for the compression method and the compression level.static void
zipFiles(net.lingala.zip4j.ZipFile zipFile4j, net.lingala.zip4j.model.ZipParameters parameters, java.io.File... toAdd)
Adds the given file(s) to the given zip file.static void
zipFiles(net.lingala.zip4j.ZipFile zipFile4j, net.lingala.zip4j.model.ZipParameters parameters, java.io.File directoryToCompress, java.util.function.Predicate<java.io.File> predicate)
Adds the given file(s) to the given zip file.static void
zipFiles(net.lingala.zip4j.ZipFile zipFile4j, net.lingala.zip4j.model.ZipParameters parameters, java.util.List<java.io.File> toAdd)
Adds the given file(s) to the given zip file.
-
-
-
Method Detail
-
extract
public static void extract(net.lingala.zip4j.ZipFile zipFile4j, java.io.File destination, java.lang.String password) throws net.lingala.zip4j.exception.ZipException
Extract.- Parameters:
zipFile4j
- the zip file4jdestination
- the destinationpassword
- the password- Throws:
net.lingala.zip4j.exception.ZipException
- the zip exception
-
zipFiles
public static void zipFiles(net.lingala.zip4j.ZipFile zipFile4j, java.io.File... toAdd) throws net.lingala.zip4j.exception.ZipException
Adds a file or several files to the given zip file with the parameters Zip4jConstants.COMP_DEFLATE for the compression method and Zip4jConstants.DEFLATE_LEVEL_NORMAL as the compression level.- Parameters:
zipFile4j
- the zip file4jtoAdd
- the to add- Throws:
net.lingala.zip4j.exception.ZipException
- the zip exception
-
zipFiles
public static void zipFiles(net.lingala.zip4j.ZipFile zipFile4j, net.lingala.zip4j.model.enums.CompressionMethod compressionMethod, net.lingala.zip4j.model.enums.CompressionLevel compressionLevel, java.io.File... toAdd) throws net.lingala.zip4j.exception.ZipException
Adds a file or several files to the given zip file with the given parameters for the compression method and the compression level.- Parameters:
zipFile4j
- the zip file4jcompressionMethod
- The compression methodcompressionLevel
- the compression leveltoAdd
- the to add- Throws:
net.lingala.zip4j.exception.ZipException
- the zip exception
-
newZipParameters
public static net.lingala.zip4j.model.ZipParameters newZipParameters(net.lingala.zip4j.model.enums.CompressionMethod compressionMethod, net.lingala.zip4j.model.enums.CompressionLevel compressionLevel)
Factory method for create a newZipParameters
from the given parameters- Parameters:
compressionMethod
- The compression methodcompressionLevel
- the compression level- Returns:
- the new
ZipParameters
object from the given parameters
-
zipFiles
public static void zipFiles(net.lingala.zip4j.ZipFile zipFile4j, net.lingala.zip4j.model.ZipParameters parameters, java.io.File... toAdd) throws net.lingala.zip4j.exception.ZipException
Adds the given file(s) to the given zip file.- Parameters:
zipFile4j
- the zip file4jparameters
- the parameterstoAdd
- the list with the files to add in the zip file- Throws:
net.lingala.zip4j.exception.ZipException
- the zip exception
-
zipFiles
public static void zipFiles(net.lingala.zip4j.ZipFile zipFile4j, net.lingala.zip4j.model.ZipParameters parameters, java.util.List<java.io.File> toAdd) throws net.lingala.zip4j.exception.ZipException
Adds the given file(s) to the given zip file.- Parameters:
zipFile4j
- the zip file4jparameters
- the parameterstoAdd
- the list with the files to add in the zip file- Throws:
net.lingala.zip4j.exception.ZipException
- the zip exception
-
zipFiles
public static void zipFiles(net.lingala.zip4j.ZipFile zipFile4j, net.lingala.zip4j.model.ZipParameters parameters, java.io.File directoryToCompress, java.util.function.Predicate<java.io.File> predicate) throws java.io.IOException
Adds the given file(s) to the given zip file.- Parameters:
zipFile4j
- the zip file4jparameters
- the parametersdirectoryToCompress
- the content of this directory will be compressedpredicate
- the predicate that tells which files should be in the zip file- Throws:
net.lingala.zip4j.exception.ZipException
- the zip exceptionjava.io.IOException
-
-