org.codehaus.plexus.util

Class Expand

public class Expand extends Object

Unzip a file.

Since: Ant 1.1 @ant.task category="packaging" name="unzip" name="unjar" name="unwar"

Author: costin@dnt.ro Stefan Bodewig Magesh Umasankar

Field Summary
Filedest
booleanoverwrite
Filesource
Method Summary
voidexecute()
Do the work.
protected voidexpandFile(File srcF, File dir)
Description of the Method
protected voidextractFile(File srcF, File dir, InputStream compressedInputStream, String entryName, Date entryDate, boolean isDirectory)
Description of the Method
Filenormalize(String path)
"normalize" the given absolute path.
FileresolveFile(File file, String filename)
Interpret the filename as a file relative to the given file - unless the filename already represents an absolute filename.
voidsetDest(File d)
Set the destination directory.
voidsetOverwrite(boolean b)
Should we overwrite files in dest, even if they are newer than the corresponding entries in the archive?
voidsetSrc(File s)
Set the path to zip-file.

Field Detail

dest

private File dest

overwrite

private boolean overwrite

source

private File source

Method Detail

execute

public void execute()
Do the work.

Throws: Exception Thrown in unrecoverable error.

expandFile

protected void expandFile(File srcF, File dir)
Description of the Method

extractFile

protected void extractFile(File srcF, File dir, InputStream compressedInputStream, String entryName, Date entryDate, boolean isDirectory)
Description of the Method

normalize

public File normalize(String path)
"normalize" the given absolute path.

This includes:

Throws: java.lang.NullPointerException if the file path is equal to null.

resolveFile

public File resolveFile(File file, String filename)
Interpret the filename as a file relative to the given file - unless the filename already represents an absolute filename.

Parameters: file the "reference" file for relative paths. This manager must be an absolute file and must not contain "./" or "../" sequences (same for \ instead of /). If it is null, this call is equivalent to new java.io.File(filename). filename a file name

Returns: an absolute file that doesn't contain "./" or "../" sequences and uses the correct separator for the current platform.

setDest

public void setDest(File d)
Set the destination directory. File will be unzipped into the destination directory.

Parameters: d Path to the directory.

setOverwrite

public void setOverwrite(boolean b)
Should we overwrite files in dest, even if they are newer than the corresponding entries in the archive?

setSrc

public void setSrc(File s)
Set the path to zip-file.

Parameters: s Path to zip-file.