Package org.apache.maven.shared.utils
Class Expand
- java.lang.Object
-
- org.apache.maven.shared.utils.Expand
-
class Expand extends java.lang.Object
Expand will unpack the given zip archive.
-
-
Field Summary
Fields Modifier and Type Field Description private static int
BUFFER_SIZE
private java.io.File
dest
destination directoryprivate 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 Summary
Constructors Constructor Description Expand()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Field Detail
-
source
private java.io.File source
Source file which should get expanded
-
dest
private java.io.File dest
destination directory
-
overwrite
private boolean overwrite
if the unpackaging should get performed if the destination already exists.
-
BUFFER_SIZE
private static final int BUFFER_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
setSrc
public void setSrc(java.io.File sourceArchive)
The zip archive which should get expanded.- Parameters:
sourceArchive
-
-
setDest
public void setDest(java.io.File destinationDirectory)
Set the destination directory into which the archive should get expanded. The directory will get created if it doesn't yet exist while executing the expand.- Parameters:
destinationDirectory
-
-
setOverwrite
public void setOverwrite(boolean overwrite)
If the destination directory should get overwritten if the content already exists. Iffalse
we will only overwrite if the local file or directory is older than the one in the archive.- Parameters:
overwrite
-
-
execute
public void execute() throws java.lang.Exception
Actually perform the unpacking of the source archive into the destination directory.- Throws:
java.lang.Exception
-
expandFile
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!
- Parameters:
srcFile
- The source file.destination
- The destination.- Throws:
java.lang.Exception
- In case of failure.
-
extractFile
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
Extract a single ZipEntry.Note: we kept this protected method for the sake of backward compatibility!
- Parameters:
archive
- the archive to unpackdestDir
- the destination dirctorycompressedInputStream
-entryName
-entryDate
-isDirectory
-- Throws:
java.lang.Exception
-
deleteFileOrDir
private void deleteFileOrDir(java.io.File targetFile) throws java.io.IOException
small helper method who deletes the given directory or file.- Parameters:
targetFile
-- Throws:
java.io.IOException
-
-