Sync.MyCopy (Apache Ant API)
Description: declaration: package: org.apache.tools.ant.taskdefs, class: Sync, class: MyCopy

# Class Sync.MyCopy

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.tools.ant.taskdefs.Copy
org.apache.tools.ant.taskdefs.Sync.MyCopy

All Implemented Interfaces:
  `Cloneable`

Enclosing class:
  `Sync`

public static class Sync.MyCopy extends Copy
Subclass Copy in order to access it's file/dir maps.

Since:
  Ant 1.6 revised by Dan Armbrust to remove orphaned directories.

- ## Field Summary

  ### Fields inherited from class Copy

  `completeDirMap, destDir, destFile, dirCopyMap, failonerror, file, fileCopyMap, filesets, fileUtils, filtering, flatten, forceOverwrite, includeEmpty, mapperElement, preserveLastModified, rcs, verbosity`
  Modifier and Type
  Field
  Description
  `protected Hashtable<File,File>`
  `completeDirMap`
  `protected File`
  `destDir`
  `protected File`
  `destFile`
  `protected Hashtable<String,String[]>`
  `dirCopyMap`
  `protected boolean`
  `failonerror`
  `protected File`
  `file`
  `protected Hashtable<String,String[]>`
  `fileCopyMap`
  `protected Vector<ResourceCollection>`
  `filesets`
  `protected FileUtils`
  `fileUtils`
  `protected boolean`
  `filtering`
  `protected boolean`
  `flatten`
  `protected boolean`
  `forceOverwrite`
  `protected boolean`
  `includeEmpty`
  `protected Mapper`
  `mapperElement`
  `protected boolean`
  `preserveLastModified`
  `protected Vector<ResourceCollection>`
  `rcs`
  `protected int`
  `verbosity`

  ### Fields inherited from class Task

  `target, taskName, taskType, wrapper`
  Modifier and Type
  Field
  Description
  `protected Target`
  `target`
  Deprecated.
  since 1.6.x.
  `protected String`
  `taskName`
  Deprecated.
  since 1.6.x.
  `protected String`
  `taskType`
  Deprecated.
  since 1.6.x.
  `protected RuntimeConfigurable`
  `wrapper`
  Deprecated.
  since 1.6.x.

  ### Fields inherited from class ProjectComponent

  `description, location, project`
  Modifier and Type
  Field
  Description
  `protected String`
  `description`
  Deprecated.
  since 1.6.x.
  `protected Location`
  `location`
  Deprecated.
  since 1.6.x.
  `protected Project`
  `project`
  Deprecated.
  since 1.6.x.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MyCopy()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `getIncludeEmptyDirs()`
  Get the includeEmptyDirs attribute.
  `File`
  `getToDir()`
  Get the destination directory.
  `protected void`
  `scan(File fromDir, File toDir, String[] files, String[] dirs)`
  Compares source files to destination files to see if they should be copied.
  `protected Map<Resource,String[]>`
  `scan(Resource[] resources, File toDir)`
  Compares source resources to destination files to see if they should be copied.
  `protected boolean`
  `supportsNonFileResources()`
  Yes, we can.

  ### Methods inherited from class Copy

  `add, add, addFileset, buildMap, buildMap, createFilterChain, createFilterSet, createMapper, doFileOperations, doResourceOperations, execute, getEncoding, getFileUtils, getFilterChains, getFilterSets, getForce, getOutputEncoding, getPreserveLastModified, isEnableMultipleMapping, setEnableMultipleMappings, setEncoding, setFailOnError, setFile, setFiltering, setFlatten, setForce, setGranularity, setIncludeEmptyDirs, setOutputEncoding, setOverwrite, setPreserveLastModified, setPreserveLastModified, setQuiet, setTodir, setTofile, setVerbose, validateAttributes`
  Modifier and Type
  Method
  Description
  `void`
  `add(ResourceCollection res)`
  Add a collection of files to copy.
  `void`
  `add(FileNameMapper fileNameMapper)`
  Add a nested filenamemapper.
  `void`
  `addFileset(FileSet set)`
  Add a set of files to copy.
  `protected void`
  `buildMap(File fromDir, File toDir, String[] names, FileNameMapper mapper, Hashtable<String,String[]> map)`
  Add to a map of files/directories to copy.
  `protected Map<Resource,String[]>`
  `buildMap(Resource[] fromResources, File toDir, FileNameMapper mapper)`
  Create a map of resources to copy.
  `FilterChain`
  `createFilterChain()`
  Add a FilterChain.
  `FilterSet`
  `createFilterSet()`
  Add a filterset.
  `Mapper`
  `createMapper()`
  Define the mapper to map source to destination files.
  `protected void`
  `doFileOperations()`
  Actually does the file (and possibly empty directory) copies.
  `protected void`
  `doResourceOperations(Map<Resource,String[]> map)`
  Actually does the resource copies.
  `void`
  `execute()`
  Perform the copy operation.
  `String`
  `getEncoding()`
  Get the character encoding to be used.
  `protected FileUtils`
  `getFileUtils()`
  Get the FileUtils for this task.
  `protected Vector<FilterChain>`
  `getFilterChains()`
  Get the filterchains being applied to this operation.
  `protected Vector<FilterSet>`
  `getFilterSets()`
  Get the filtersets being applied to this operation.
  `boolean`
  `getForce()`
  Whether read-only destinations will be overwritten.
  `String`
  `getOutputEncoding()`
  Get the character encoding for output files.
  `boolean`
  `getPreserveLastModified()`
  Get whether to give the copied files the same last modified time as the original files.
  `boolean`
  `isEnableMultipleMapping()`
  Get whether multiple mapping is enabled.
  `void`
  `setEnableMultipleMappings(boolean enableMultipleMappings)`
  Set method of handling mappers that return multiple mappings for a given source path.
  `void`
  `setEncoding(String encoding)`
  Set the character encoding.
  `void`
  `setFailOnError(boolean failonerror)`
  Set whether to fail when errors are encountered.
  `void`
  `setFile(File file)`
  Set a single source file to copy.
  `void`
  `setFiltering(boolean filtering)`
  Set filtering mode.
  `void`
  `setFlatten(boolean flatten)`
  Set whether files copied from directory trees will be "flattened" into a single directory.
  `void`
  `setForce(boolean f)`
  Whether read-only destinations will be overwritten.
  `void`
  `setGranularity(long granularity)`
  Set the number of milliseconds leeway to give before deciding a target is out of date.
  `void`
  `setIncludeEmptyDirs(boolean includeEmpty)`
  Set whether to copy empty directories.
  `void`
  `setOutputEncoding(String encoding)`
  Set the character encoding for output files.
  `void`
  `setOverwrite(boolean overwrite)`
  Set overwrite mode regarding existing destination file(s).
  `void`
  `setPreserveLastModified(boolean preserve)`
  Give the copied files the same last modified time as the original files.
  `void`
  `setPreserveLastModified(String preserve)`
  Deprecated.
  since 1.5.x.
  `void`
  `setQuiet(boolean quiet)`
  Set quiet mode.
  `void`
  `setTodir(File destDir)`
  Set the destination directory.
  `void`
  `setTofile(File destFile)`
  Set the destination file.
  `void`
  `setVerbose(boolean verbose)`
  Set verbose mode.
  `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 Task

  `bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType`
  Modifier and Type
  Method
  Description
  `final void`
  `bindToOwner(Task owner)`
  Bind a task to another; use this when configuring a newly created task to do work on behalf of another.
  `Target`
  `getOwningTarget()`
  Returns the container target of this task.
  `RuntimeConfigurable`
  `getRuntimeConfigurableWrapper()`
  Returns the wrapper used for runtime configuration.
  `String`
  `getTaskName()`
  Returns the name to use in logging messages.
  `String`
  `getTaskType()`
  Return the type of task.
  `protected RuntimeConfigurable`
  `getWrapper()`
  Return the runtime configurable structure for this task.
  `protected void`
  `handleErrorFlush(String output)`
  Handles an error line by logging it with the WARN priority.
  `protected void`
  `handleErrorOutput(String output)`
  Handles an error output by logging it with the WARN priority.
  `protected void`
  `handleFlush(String output)`
  Handles output by logging it with the INFO priority.
  `protected int`
  `handleInput(byte[] buffer, int offset, int length)`
  Handle an input request by this task.
  `protected void`
  `handleOutput(String output)`
  Handles output by logging it with the INFO priority.
  `void`
  `init()`
  Called by the project to let the task initialize properly.
  `protected final boolean`
  `isInvalid()`
  Has this task been marked invalid?
  `void`
  `log(String msg)`
  Logs a message with the default (INFO) priority.
  `void`
  `log(String msg, int msgLevel)`
  Logs a message with the given priority.
  `void`
  `log(String msg, Throwable t, int msgLevel)`
  Logs a message with the given priority.
  `void`
  `log(Throwable t, int msgLevel)`
  Logs a message with the given priority.
  `void`
  `maybeConfigure()`
  Configures this task - if it hasn't been done already.
  `final void`
  `perform()`
  Performs this task if it's still valid, or gets a replacement version and performs that otherwise.
  `void`
  `reconfigure()`
  Force the task to be reconfigured from its RuntimeConfigurable.
  `void`
  `setOwningTarget(Target target)`
  Sets the target container of this task.
  `void`
  `setRuntimeConfigurableWrapper(RuntimeConfigurable wrapper)`
  Sets the wrapper to be used for runtime configuration.
  `void`
  `setTaskName(String name)`
  Sets the name to use in logging messages.
  `void`
  `setTaskType(String type)`
  Sets the name with which the task has been invoked.

  ### Methods inherited from class ProjectComponent

  `clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject`
  Modifier and Type
  Method
  Description
  `Object`
  `clone()`
  `String`
  `getDescription()`
  Returns the description of the current action.
  `Location`
  `getLocation()`
  Returns the file/location where this task was defined.
  `Project`
  `getProject()`
  Returns the project to which this component belongs.
  `void`
  `setDescription(String desc)`
  Sets a description of the current action.
  `void`
  `setLocation(Location location)`
  Sets the file/location where this task was defined.
  `void`
  `setProject(Project project)`
  Sets the project object of this component.

  ### Methods inherited from class Object

  `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### MyCopy

    public MyCopy()

- ## Method Details

  - ### scan

    protected void scan(File fromDir, File toDir, String[] files, String[] dirs)
    Description copied from class: `Copy`
    Compares source files to destination files to see if they should be copied.
    Overrides:
      `scan` in class `Copy`
    Parameters:
      `fromDir` - The source directory.
      `toDir` - The destination directory.
      `files` - A list of files to copy.
      `dirs` - A list of directories to copy.
    See Also:
      - Copy.scan(File, File, String[], String[])

  - ### scan

    protected Map<Resource,String[]> scan(Resource[] resources, File toDir)
    Description copied from class: `Copy`
    Compares source resources to destination files to see if they should be copied.
    Overrides:
      `scan` in class `Copy`
    Parameters:
      `resources` - The source resources.
      `toDir` - The destination directory.
    Returns:
      a Map with the out-of-date resources as keys and an array of target file names as values.
    See Also:
      - Copy.scan(Resource[], File)

  - ### getToDir

    public File getToDir()
    Get the destination directory.
    Returns:
      the destination directory

  - ### getIncludeEmptyDirs

    public boolean getIncludeEmptyDirs()
    Get the includeEmptyDirs attribute.
    Returns:
      true if emptyDirs are to be included

  - ### supportsNonFileResources

    protected boolean supportsNonFileResources()
    Yes, we can.
    Overrides:
      `supportsNonFileResources` in class `Copy`
    Returns:
      true always.
    Since:
      Ant 1.7