KeySubst (Apache Ant API)
Date: 2018-07-10

org.apache.tools.ant.taskdefs

## Class KeySubst

- java.lang.Object
- - org.apache.tools.ant.ProjectComponent
  - - org.apache.tools.ant.Task
    - - org.apache.tools.ant.taskdefs.KeySubst

- All Implemented Interfaces:
    java.lang.Cloneable

  Deprecated.
  KeySubst is deprecated since Ant 1.1. Use Filter + Copy instead.

      @Deprecated
      public class KeySubst
      extends Task

  Keyword substitution. Input file is written to output file. Do not make input file same as output file. Keywords in input files look like this: @foo@. See the docs for the setKeys method to understand how to do the substitutions.
  Since:
    Ant 1.1

- - ### Field Summary

    - ### Fields inherited from class org.apache.tools.ant.Task

      `target, taskName, taskType, wrapper`

    - ### Fields inherited from class org.apache.tools.ant.ProjectComponent

      `description, location, project`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `KeySubst()` Deprecated.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `execute()` Deprecated. Do the execution.
    `static void` | `main(java.lang.String[] args)` Deprecated. A test method.
    `static java.lang.String` | `replace(java.lang.String origString, java.util.Hashtable<java.lang.String,java.lang.String> keys)` Deprecated. Does replacement on text using the hashtable of keys.
    `void` | `setDest(java.io.File dest)` Deprecated. Set the destination file.
    `void` | `setKeys(java.lang.String keys)` Deprecated. Sets the keys.
    `void` | `setSep(java.lang.String sep)` Deprecated. Sets the separator between name=value arguments in setKeys().
    `void` | `setSrc(java.io.File s)` Deprecated. Set the source file.

    - ### Methods inherited from class org.apache.tools.ant.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`

    - ### Methods inherited from class org.apache.tools.ant.ProjectComponent

      `clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject`

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### KeySubst

          public KeySubst()

      Deprecated.

  - ### Method Detail

    - #### execute

          public void execute()
                       throws BuildException

      Deprecated.
      Do the execution.
      Overrides:
        `execute` in class `Task`
      Throws:
        `BuildException` - on error

    - #### setSrc

          public void setSrc(java.io.File s)

      Deprecated.
      Set the source file.
      Parameters:
        `s` - the source file

    - #### setDest

          public void setDest(java.io.File dest)

      Deprecated.
      Set the destination file.
      Parameters:
        `dest` - the destination file

    - #### setSep

          public void setSep(java.lang.String sep)

      Deprecated.
      Sets the separator between name=value arguments in setKeys(). By default it is "*".
      Parameters:
        `sep` - the separator string

    - #### setKeys

          public void setKeys(java.lang.String keys)

      Deprecated.
      Sets the keys. Format string is like this:

      name=value*name2=value

      Names are case sensitive.

      Use the setSep() method to change the * to something else if you need to use * as a name or value.

      Parameters:
        `keys` - a `String` value

    - #### main

          public static void main(java.lang.String[] args)

      Deprecated.
      A test method.
      Parameters:
        `args` - not used

    - #### replace

          public static java.lang.String replace(java.lang.String origString,
                                                 java.util.Hashtable<java.lang.String,java.lang.String> keys)
                                          throws BuildException

      Deprecated.
      Does replacement on text using the hashtable of keys.
      Parameters:
        `origString` - an input string
        `keys` - mapping of keys to values
      Returns:
        the string with the replacements in it.
      Throws:
        `BuildException` - on error