org.apache.tools.ant.taskdefs

Class Tar

public class Tar extends MatchingTask

Creates a tar archive.

Since: Ant 1.1

UNKNOWN: category="packaging"

Nested Class Summary
static classTar.TarCompressionMethod
Valid Modes for Compression attribute to Tar Task
static classTar.TarFileSet
This is a FileSet with the option to specify permissions and other attributes.
static classTar.TarLongFileMode
Set of options for long file handling in the task.
Field Summary
static StringFAIL
static StringGNU
static StringOMIT
static StringTRUNCATE
static StringWARN
Method Summary
protected booleanarchiveIsUpToDate(String[] files)
Is the archive up to date in relationship to a list of files.
protected booleanarchiveIsUpToDate(String[] files, File dir)
Is the archive up to date in relationship to a list of files.
Tar.TarFileSetcreateTarFileSet()
Add a new fileset with the option to specify permissions
voidexecute()
do the business
voidsetBasedir(File baseDir)
This is the base directory to look in for things to tar.
voidsetCompression(Tar.TarCompressionMethod mode)
Set compression method.
voidsetDestFile(File destFile)
Set is the name/location of where to create the tar file.
voidsetLongfile(String mode)
Set how to handle long files, those with a path>100 chars.
voidsetLongfile(Tar.TarLongFileMode mode)
Set how to handle long files, those with a path>100 chars.
voidsetTarfile(File tarFile)
Set is the name/location of where to create the tar file.
protected voidtarFile(File file, TarOutputStream tOut, String vPath, Tar.TarFileSet tarFileSet)
tar a file

Field Detail

FAIL

public static final String FAIL

Deprecated: Tar.FAIL is deprecated and is replaced with Tar.TarLongFileMode.FAIL

GNU

public static final String GNU

Deprecated: Tar.GNU is deprecated and is replaced with Tar.TarLongFileMode.GNU

OMIT

public static final String OMIT

Deprecated: Tar.OMIT is deprecated and is replaced with Tar.TarLongFileMode.OMIT

TRUNCATE

public static final String TRUNCATE

Deprecated: Tar.TRUNCATE is deprecated and is replaced with Tar.TarLongFileMode.TRUNCATE

WARN

public static final String WARN

Deprecated: Tar.WARN is deprecated and is replaced with Tar.TarLongFileMode.WARN

Method Detail

archiveIsUpToDate

protected boolean archiveIsUpToDate(String[] files)

Deprecated: use the two-arg version instead.

Is the archive up to date in relationship to a list of files.

Parameters: files the files to check

Returns: true if the archive is up to date.

archiveIsUpToDate

protected boolean archiveIsUpToDate(String[] files, File dir)
Is the archive up to date in relationship to a list of files.

Parameters: files the files to check dir the base directory for the files.

Returns: true if the archive is up to date.

Since: Ant 1.5.2

createTarFileSet

public Tar.TarFileSet createTarFileSet()
Add a new fileset with the option to specify permissions

Returns: the tar fileset to be used as the nested element.

execute

public void execute()
do the business

Throws: BuildException on error

setBasedir

public void setBasedir(File baseDir)
This is the base directory to look in for things to tar.

Parameters: baseDir the base directory.

setCompression

public void setCompression(Tar.TarCompressionMethod mode)
Set compression method. Allowable values are

Parameters: mode the compression method.

setDestFile

public void setDestFile(File destFile)
Set is the name/location of where to create the tar file.

Parameters: destFile The output of the tar

Since: Ant 1.5

setLongfile

public void setLongfile(String mode)

Deprecated: setLongFile(String) is deprecated and is replaced with setLongFile(Tar.TarLongFileMode) to make Ant's Introspection mechanism do the work and also to encapsulate operations on the mode in its own class.

Set how to handle long files, those with a path>100 chars. Optional, default=warn.

Allowable values are

Parameters: mode the mode string to handle long files.

setLongfile

public void setLongfile(Tar.TarLongFileMode mode)
Set how to handle long files, those with a path>100 chars. Optional, default=warn.

Allowable values are

Parameters: mode the mode to handle long file names.

setTarfile

public void setTarfile(File tarFile)

Deprecated: for consistency with other tasks, please use setDestFile()

Set is the name/location of where to create the tar file.

Parameters: tarFile the location of the tar file.

tarFile

protected void tarFile(File file, TarOutputStream tOut, String vPath, Tar.TarFileSet tarFileSet)
tar a file

Parameters: file the file to tar tOut the output stream vPath the path name of the file to tar tarFileSet the fileset that the file came from.

Throws: IOException on error

Copyright B) 2000-2007 Apache Software Foundation. All Rights Reserved.