|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.tools.ant.Task | +--org.apache.tools.ant.taskdefs.Copy
A consolidated copy task. Copies a file or directory to a new file or directory. Files are only copied if the source file is newer than the destination file, or when the destination file does not exist. It is possible to explicitly overwrite existing files.
This implementation is based on Arnout Kuiper's initial design document, the following mailing list discussions, and the copyfile/copydir tasks.
Field Summary | |
protected java.io.File |
destDir
|
protected java.io.File |
destFile
|
protected java.util.Hashtable |
dirCopyMap
|
protected java.io.File |
file
|
protected java.util.Hashtable |
fileCopyMap
|
protected java.util.Vector |
filesets
|
protected boolean |
filtering
|
protected boolean |
flatten
|
protected boolean |
forceOverwrite
|
protected boolean |
includeEmpty
|
protected Mapper |
mapperElement
|
protected boolean |
preserveLastModified
|
protected int |
verbosity
|
Fields inherited from class org.apache.tools.ant.Task |
description, location, project, target, taskName, taskType, wrapper |
Constructor Summary | |
Copy()
|
Method Summary | |
void |
addFileset(FileSet set)
Adds a set of files (nested fileset attribute). |
protected void |
buildMap(java.io.File fromDir,
java.io.File toDir,
java.lang.String[] names,
FileNameMapper mapper,
java.util.Hashtable map)
|
Mapper |
createMapper()
Defines the FileNameMapper to use (nested mapper element). |
protected void |
doFileOperations()
Actually does the file (and possibly empty directory) copies. |
void |
execute()
Performs the copy operation. |
protected void |
scan(java.io.File fromDir,
java.io.File toDir,
java.lang.String[] files,
java.lang.String[] dirs)
Compares source files to destination files to see if they should be copied. |
void |
setFile(java.io.File file)
Sets a single source file to copy. |
void |
setFiltering(boolean filtering)
Sets filtering. |
void |
setFlatten(boolean flatten)
When copying directory trees, the files can be "flattened" into a single directory. |
void |
setIncludeEmptyDirs(boolean includeEmpty)
Used to copy empty directories. |
void |
setOverwrite(boolean overwrite)
Overwrite any existing destination file(s). |
void |
setPreserveLastModified(java.lang.String preserve)
Give the copied files the same last modified time as the original files. |
void |
setTodir(java.io.File destDir)
Sets the destination directory. |
void |
setTofile(java.io.File destFile)
Sets the destination file. |
void |
setVerbose(boolean verbose)
Used to force listing of all names of copied files. |
protected void |
validateAttributes()
Ensure we have a consistent and legal set of attributes, and set any internal flags necessary based on different combinations of attributes. |
Methods inherited from class org.apache.tools.ant.Task |
getDescription, getLocation, getOwningTarget, getProject, getRuntimeConfigurableWrapper, getTaskName, init, log, log, maybeConfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.io.File file
protected java.io.File destFile
protected java.io.File destDir
protected java.util.Vector filesets
protected boolean filtering
protected boolean preserveLastModified
protected boolean forceOverwrite
protected boolean flatten
protected int verbosity
protected boolean includeEmpty
protected java.util.Hashtable fileCopyMap
protected java.util.Hashtable dirCopyMap
protected Mapper mapperElement
Constructor Detail |
public Copy()
Method Detail |
public void setFile(java.io.File file)
public void setTofile(java.io.File destFile)
public void setTodir(java.io.File destDir)
public void setPreserveLastModified(java.lang.String preserve)
public void setFiltering(boolean filtering)
public void setOverwrite(boolean overwrite)
public void setFlatten(boolean flatten)
public void setVerbose(boolean verbose)
public void setIncludeEmptyDirs(boolean includeEmpty)
public void addFileset(FileSet set)
public Mapper createMapper() throws BuildException
public void execute() throws BuildException
execute
in class Task
org.apache.tools.ant.Task
BuildException
- if someting goes wrong with the buildprotected void validateAttributes() throws BuildException
protected void scan(java.io.File fromDir, java.io.File toDir, java.lang.String[] files, java.lang.String[] dirs)
protected void buildMap(java.io.File fromDir, java.io.File toDir, java.lang.String[] names, FileNameMapper mapper, java.util.Hashtable map)
protected void doFileOperations()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |