class Expand
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static int |
BUFFER_SIZE |
private java.io.File |
dest
destination directory
|
private boolean |
overwrite
if the unpackaging should get performed if the destination already exists.
|
private java.io.File |
source
Source file which should get expanded
|
Constructor and Description |
---|
Expand() |
Modifier and Type | Method and Description |
---|---|
private void |
deleteFileOrDir(java.io.File targetFile)
small helper method who deletes the given directory or file.
|
void |
execute()
Actually perform the unpacking of the source archive
into the destination directory.
|
(package private) void |
expandFile(java.io.File srcFile,
java.io.File destination)
It is intended to be overwritten when implementing an own unarchiver
|
(package private) void |
extractFile(java.io.File archive,
java.io.File destDir,
java.io.InputStream compressedInputStream,
java.lang.String entryName,
java.util.Date entryDate,
boolean isDirectory)
Extract a single ZipEntry.
|
void |
setDest(java.io.File destinationDirectory)
Set the destination directory into which the archive should get expanded.
|
void |
setOverwrite(boolean overwrite)
If the destination directory should get overwritten if the content
already exists.
|
void |
setSrc(java.io.File sourceArchive)
The zip archive which should get expanded.
|
private java.io.File source
private java.io.File dest
private boolean overwrite
private static final int BUFFER_SIZE
public void setSrc(java.io.File sourceArchive)
sourceArchive
- public void setDest(java.io.File destinationDirectory)
destinationDirectory
- public void setOverwrite(boolean overwrite)
false
we will only overwrite if the local
file or directory is older than the one in the archive.overwrite
- public void execute() throws java.lang.Exception
java.lang.Exception
void expandFile(java.io.File srcFile, java.io.File destination) throws java.lang.Exception
It is intended to be overwritten when implementing an own unarchiver
Note: we kept this protected method for the sake of backward compatibility!
srcFile
- The source file.destination
- The destination.java.lang.Exception
- In case of failure.void extractFile(java.io.File archive, java.io.File destDir, java.io.InputStream compressedInputStream, java.lang.String entryName, java.util.Date entryDate, boolean isDirectory) throws java.lang.Exception
Note: we kept this protected method for the sake of backward compatibility!
archive
- the archive to unpackdestDir
- the destination dirctorycompressedInputStream
- entryName
- entryDate
- isDirectory
- java.lang.Exception
private void deleteFileOrDir(java.io.File targetFile) throws java.io.IOException
targetFile
- java.io.IOException