Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tools.ant.taskdefs
Class Patch

    java.lang.Object
      org.apache.tools.ant.ProjectComponent
          org.apache.tools.ant.Task
              org.apache.tools.ant.taskdefs.Patch

public class Patch
extends Task

Patches a file by applying a 'diff' file to it; requires "patch" to be on the execution path.

Since:
  Ant 1.1
Author:
  Stefan Bodewig

Field Summary

Fields inherited from class org.apache.tools.ant.Task
`description, location, target, taskName, taskType, wrapper`

Fields inherited from class org.apache.tools.ant.ProjectComponent
`project`

Constructor Summary
`Patch()`

Method Summary
`void` | `execute()` execute patch
`void` | `setBackups(boolean backups)` flag to create backups; optional, default=false
`void` | `setDir(java.io.File directory)` The directory to run the patch command in, defaults to the project's base directory.
`void` | `setIgnorewhitespace(boolean ignore)` flag to ignore whitespace differences; default=false
`void` | `setOriginalfile(java.io.File file)` The file to patch; optional if it can be inferred from the diff file
`void` | `setPatchfile(java.io.File file)` The file containing the diff output; required.
`void` | `setQuiet(boolean q)` Work silently unless an error occurs; optional, default=false
`void` | `setReverse(boolean r)` Assume patch was created with old and new files swapped; optional, default=false
`void` | `setStrip(int num)` Strip the smallest prefix containing num leading slashes from filenames.

Methods inherited from class org.apache.tools.ant.Task
`getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorFlush, handleErrorOutput, handleFlush, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName`

Methods inherited from class org.apache.tools.ant.ProjectComponent
`getProject, setProject`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Patch

    public Patch()

Method Detail

### setOriginalfile

    public void setOriginalfile(java.io.File file)

  The file to patch; optional if it can be inferred from the diff file

### setPatchfile

    public void setPatchfile(java.io.File file)

  The file containing the diff output; required.

### setBackups

    public void setBackups(boolean backups)

  flag to create backups; optional, default=false

### setIgnorewhitespace

    public void setIgnorewhitespace(boolean ignore)

  flag to ignore whitespace differences; default=false

### setStrip

    public void setStrip(int num)
                  throws BuildException

  Strip the smallest prefix containing num leading slashes from filenames.

  patch's -p option.

  Parameters:
    `num` - number of lines to strip
  Throws:
    `BuildException`

### setQuiet

    public void setQuiet(boolean q)

  Work silently unless an error occurs; optional, default=false

### setReverse

    public void setReverse(boolean r)

  Assume patch was created with old and new files swapped; optional, default=false

### setDir

    public void setDir(java.io.File directory)
                throws BuildException

  The directory to run the patch command in, defaults to the project's base directory.

  Throws:
    `BuildException`
  Since:
    Ant 1.5

### execute

    public void execute()
                 throws BuildException

  execute patch

  Overrides:
    `execute` in class `Task`
  Throws:
    `BuildException` - when it all goes a bit pear shaped

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.