java.lang.Object
io.github.astrapi69.zip.UnZipper
The `UnZipper` class provides methods to extract zip entries to a specified directory. It
utilizes `ZipExtensions` for performing the extraction operations.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Builder class for constructing `Unzipper` objects. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic UnZipper.UnzipperBuilder
builder()
Creates a builder for constructing `Unzipper` objects.void
extractZipEntry
(ZipFile zipFile, ZipEntry target, File toDirectory) Extracts a specific zip entry to the target directory.getToDir()
Retrieves the current target directory for extraction.Retrieves the current zip file being used for extraction.void
Sets the target directory for extraction.void
setZipFile
(ZipFile zipFile) Sets the zip file to use for extraction.Creates a builder initialized with the current `Unzipper` instance's properties.toString()
Returns a string representation of the `Unzipper` object, showing its current target directory and zip file.void
unzip()
Extracts all entries from the current zip file to the current target directory.void
Extracts all entries from the specified zip file to the specified target directory.
-
Constructor Details
-
UnZipper
public UnZipper()Default constructor. -
UnZipper
Constructs an `Unzipper` with the given target directory and zip file.- Parameters:
toDir
- the directory to extract files tozipFile
- the zip file to extract entries from
-
UnZipper
Constructs an `Unzipper` with the given zip file and target directory.- Parameters:
zipFile
- the zip file to extract entries fromtoDir
- the directory to extract files to
-
-
Method Details
-
builder
Creates a builder for constructing `Unzipper` objects.- Returns:
- a new `UnzipperBuilder` instance
-
extractZipEntry
Extracts a specific zip entry to the target directory.- Parameters:
zipFile
- the zip file containing the entrytarget
- the zip entry to extracttoDirectory
- the directory to extract the entry to- Throws:
IOException
- if an I/O error occurs during extraction
-
getToDir
Retrieves the current target directory for extraction.- Returns:
- the current target directory
-
setToDir
Sets the target directory for extraction.- Parameters:
toDir
- the directory to set as the target for extraction
-
getZipFile
Retrieves the current zip file being used for extraction.- Returns:
- the current zip file
-
setZipFile
Sets the zip file to use for extraction.- Parameters:
zipFile
- the zip file to set for extraction
-
toBuilder
Creates a builder initialized with the current `Unzipper` instance's properties.- Returns:
- a new `UnzipperBuilder` initialized with the current instance's properties
-
toString
Returns a string representation of the `Unzipper` object, showing its current target directory and zip file. -
unzip
Extracts all entries from the current zip file to the current target directory.- Throws:
IOException
- if an I/O error occurs during extraction
-
unzip
Extracts all entries from the specified zip file to the specified target directory.- Parameters:
zipFile
- the zip file to extract entries fromtoDir
- the directory to extract entries to- Throws:
IOException
- if an I/O error occurs during extraction
-