Top Description Fields Constructors Methods
org.apache.tools.ant.taskdefs.optional

public Class Cab

extends MatchingTask
Class Inheritance
Imports
java.io.BufferedWriter, .File, .FileWriter, .IOException, .OutputStream, java.util.Collections, .Vector, org.apache.tools.ant.BuildException, .DirectoryScanner, .Project, org.apache.tools.ant.taskdefs.ExecTask, .Execute, .LogOutputStream, .MatchingTask, .StreamPumper, org.apache.tools.ant.taskdefs.condition.Os, org.apache.tools.ant.types.FileSet, org.apache.tools.ant.util.FileUtils

Create a CAB archive.

Field Summary

Modifier and TypeField and Description
protected String
private File
private File
private String
private static final int
private boolean
private boolean
private static final FileUtils
private boolean
Inherited from org.apache.tools.ant.taskdefs.MatchingTask:
fileset

Constructor Summary

AccessConstructor and Description
public
Cab()

Method Summary

Modifier and TypeMethod and Description
public void
addFileset(FileSet
a set of files to archive.
fileset
)

Adds a set of files to archive.

protected void
appendFiles(Vector<String>
the vector to append the files to.
files
,
DirectoryScanner
the scanner to get the files from.
ds
)

Append all files found by a directory scanner to a vector.

protected void
checkConfiguration()

Check if the attributes and nested elements are correct.

protected ExecTask

Returns:

the delegate.
createExec
()

Create a new exec delegate.

protected File

Returns:

the list file created.
createListFile
(Vector<String>
the list of files to use.
files
)

Creates a list file.

public void
execute()

Overrides org.apache.tools.ant.Task.execute.

execute this task.
protected Vector<String>

Returns:

the list of files.
getFileList
()

Get the complete list of files to be included in the cab.

protected boolean

Returns:

true if the cab file is newer than its dependents.
isUpToDate
(Vector<String>
the list of files to check.
files
)

Check to see if the target is up to date with respect to input files.

public void
setBasedir(File
base directory for files to cab.
baseDir
)

Base directory to look in for files to CAB.

public void
setCabfile(File
the location of the cab file.
cabFile
)

The name/location of where to create the .cab file.

public void
setCompress(boolean
a boolean value.
compress
)

If true, compress the files otherwise only store them.

public void
setOptions(String
cabarc command line options.
options
)

Sets additional cabarc options that are not supported directly.

public void
setVerbose(boolean
a boolean value.
verbose
)

If true, display cabarc output.

Inherited from org.apache.tools.ant.taskdefs.MatchingTask:
addaddAndaddContainsaddContainsRegexpaddCustomaddDateaddDependaddDepthaddDifferentaddFilenameaddMajorityaddModifiedaddNoneaddNotaddOraddPresentaddSelectoraddSizeaddTypeappendSelectorcreateExcludecreateExcludesFilecreateIncludecreateIncludesFilecreatePatternSetgetDirectoryScannergetImplicitFileSetgetSelectorshasSelectorsselectorCountselectorElementssetCaseSensitivesetDefaultexcludessetExcludessetExcludesfilesetFollowSymlinkssetIncludessetIncludesfilesetProjectXsetIgnoreXsetItems

Field Detail

archiveTypeback to summary
protected String archiveType
baseDirback to summary
private File baseDir
cabFileback to summary
private File cabFile
cmdOptionsback to summary
private String cmdOptions
DEFAULT_RESULTback to summary
private static final int DEFAULT_RESULT
doCompressback to summary
private boolean doCompress
doVerboseback to summary
private boolean doVerbose
FILE_UTILSback to summary
private static final FileUtils FILE_UTILS
filesetAddedback to summary
private boolean filesetAdded

Constructor Detail

Cabback to summary
public Cab()

Method Detail

addFilesetback to summary
public void addFileset(FileSet fileset)

Adds a set of files to archive.

Parameters
fileset:FileSet

a set of files to archive.

appendFilesback to summary
protected void appendFiles(Vector<String> files, DirectoryScanner ds)

Append all files found by a directory scanner to a vector.

Parameters
files:Vector<String>

the vector to append the files to.

ds:DirectoryScanner

the scanner to get the files from.

checkConfigurationback to summary
protected void checkConfiguration() throws BuildException

Check if the attributes and nested elements are correct.

Exceptions
BuildException:
on error.
createExecback to summary
protected ExecTask createExec() throws BuildException

Create a new exec delegate. The delegate task is populated so that it appears in the logs to be the same task as this one.

Returns:ExecTask

the delegate.

Exceptions
BuildException:
on error.
createListFileback to summary
protected File createListFile(Vector<String> files) throws IOException

Creates a list file. This temporary file contains a list of all files to be included in the cab, one file per line.

This method expects to only be called on Windows and thus quotes the file names.

Parameters
files:Vector<String>

the list of files to use.

Returns:File

the list file created.

Exceptions
IOException:
if there is an error.
executeback to summary
public void execute() throws BuildException

Overrides org.apache.tools.ant.Task.execute.

execute this task.

Annotations
@Override
Exceptions
BuildException:
on error.
getFileListback to summary
protected Vector<String> getFileList() throws BuildException

Get the complete list of files to be included in the cab. Filenames are gathered from the fileset if it has been added, otherwise from the traditional include parameters.

Returns:Vector<String>

the list of files.

Exceptions
BuildException:
if there is an error.
isUpToDateback to summary
protected boolean isUpToDate(Vector<String> files)

Check to see if the target is up to date with respect to input files.

Parameters
files:Vector<String>

the list of files to check.

Returns:boolean

true if the cab file is newer than its dependents.

setBasedirback to summary
public void setBasedir(File baseDir)

Base directory to look in for files to CAB.

Parameters
baseDir:File

base directory for files to cab.

setCabfileback to summary
public void setCabfile(File cabFile)

The name/location of where to create the .cab file.

Parameters
cabFile:File

the location of the cab file.

setCompressback to summary
public void setCompress(boolean compress)

If true, compress the files otherwise only store them.

Parameters
compress:boolean

a boolean value.

setOptionsback to summary
public void setOptions(String options)

Sets additional cabarc options that are not supported directly.

Parameters
options:String

cabarc command line options.

setVerboseback to summary
public void setVerbose(boolean verbose)

If true, display cabarc output.

Parameters
verbose:boolean

a boolean value.