RedirectorElement (Apache Ant API)
Description: declaration: package: org.apache.tools.ant.types, class: RedirectorElement

# Class RedirectorElement

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.types.DataType
org.apache.tools.ant.types.RedirectorElement

All Implemented Interfaces:
  `Cloneable`

public class RedirectorElement extends DataType
Element representation of a `Redirector`.

Since:
  Ant 1.6.2

- ## Field Summary

  ### Fields inherited from class DataType

  `checked, ref`
  Modifier and Type
  Field
  Description
  `protected boolean`
  `checked`
  Deprecated.
  since 1.7.
  `protected Reference`
  `ref`
  Deprecated.
  since 1.7.

  ### 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
  `RedirectorElement()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addConfiguredErrorMapper(Mapper errorMapper)`
  Add the error file mapper.
  `void`
  `addConfiguredInputMapper(Mapper inputMapper)`
  Add the input file mapper.
  `void`
  `addConfiguredOutputMapper(Mapper outputMapper)`
  Add the output file mapper.
  `void`
  `configure(Redirector redirector)`
  Configure the specified `Redirector`.
  `void`
  `configure(Redirector redirector, String sourcefile)`
  Configure the specified `Redirector` for the specified sourcefile.
  `FilterChain`
  `createErrorFilterChain()`
  Create a nested error `FilterChain`.
  `FilterChain`
  `createInputFilterChain()`
  Create a nested input `FilterChain`.
  `protected Mapper`
  `createMergeMapper(File destfile)`
  Create a merge mapper pointing to the specified destination file.
  `FilterChain`
  `createOutputFilterChain()`
  Create a nested output `FilterChain`.
  `protected void`
  `dieOnCircularReference(Stack<Object> stk, Project p)`
  Overrides the version of DataType to recurse on all DataType child elements that may have been added.
  `void`
  `setAlwaysLog(boolean alwaysLog)`
  If true, (error and non-error) output will be "teed", redirected as specified while being sent to Ant's logging mechanism as if no redirection had taken place.
  `void`
  `setAppend(boolean append)`
  Whether output should be appended to or overwrite an existing file.
  `void`
  `setBinaryOutput(boolean b)`
  Whether to consider the output created by the process binary.
  `void`
  `setCreateEmptyFiles(boolean createEmptyFiles)`
  Whether output and error files should be created even when empty.
  `void`
  `setError(File error)`
  Set the file to which standard error is to be redirected.
  `void`
  `setErrorEncoding(String errorEncoding)`
  Set the error encoding.
  `void`
  `setErrorProperty(String errorProperty)`
  Property name whose value should be set to the error of the process.
  `void`
  `setInput(File input)`
  Set the input to use for the task.
  `void`
  `setInputEncoding(String inputEncoding)`
  Set the input encoding.
  `void`
  `setInputString(String inputString)`
  Set the string to use as input
  `void`
  `setLogError(boolean logError)`
  Controls whether error output of exec is logged.
  `void`
  `setLogInputString(boolean logInputString)`
  Set whether to include the value of the input string in log messages.
  `void`
  `setOutput(File out)`
  File the output of the process is redirected to.
  `void`
  `setOutputEncoding(String outputEncoding)`
  Set the output encoding.
  `void`
  `setOutputProperty(String outputProperty)`
  Property name whose value should be set to the output of the process.
  `void`
  `setRefid(Reference r)`
  Make this instance in effect a reference to another instance.
  `protected File[]`
  `toFileArray(String[] name)`
  Return a `File[]` from the specified set of filenames.

  ### Methods inherited from class DataType

  `checkAttributesAllowed, checkChildrenAllowed, circularReference, clone, dieOnCircularReference, dieOnCircularReference, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, pushAndInvokeCircularReferenceCheck, setChecked, tooManyAttributes, toString`
  Modifier and Type
  Method
  Description
  `protected void`
  `checkAttributesAllowed()`
  check that it is ok to set attributes, i.e that no reference is defined
  `protected void`
  `checkChildrenAllowed()`
  check that it is ok to add children, i.e that no reference is defined
  `protected BuildException`
  `circularReference()`
  Creates an exception that indicates the user has generated a loop of data types referencing each other.
  `Object`
  `clone()`
  `protected void`
  `dieOnCircularReference()`
  Convenience method.
  `protected void`
  `dieOnCircularReference(Project p)`
  Convenience method.
  `protected <T> T`
  `getCheckedRef()`
  Deprecated.
  use getCheckedRef(Class)
  `protected <T> T`
  `getCheckedRef(Class<T> requiredClass)`
  Performs the check for circular references and returns the referenced object.
  `protected <T> T`
  `getCheckedRef(Class<T> requiredClass, String dataTypeName)`
  Performs the check for circular references and returns the referenced object.
  `protected <T> T`
  `getCheckedRef(Class<T> requiredClass, String dataTypeName, Project project)`
  Performs the check for circular references and returns the referenced object.
  `protected <T> T`
  `getCheckedRef(Project p)`
  Deprecated.
  use getCheckedRef(Class)
  `protected String`
  `getDataTypeName()`
  Gets as descriptive as possible a name used for this datatype instance.
  `Reference`
  `getRefid()`
  get the reference set on this object
  `static void`
  `invokeCircularReferenceCheck(DataType dt, Stack<Object> stk, Project p)`
  Allow DataTypes outside org.apache.tools.ant.types to indirectly call dieOnCircularReference on nested DataTypes.
  `protected boolean`
  `isChecked()`
  The flag that is used to indicate that circular references have been checked.
  `boolean`
  `isReference()`
  Has the refid attribute of this element been set?
  `protected BuildException`
  `noChildrenAllowed()`
  Creates an exception that indicates that this XML element must not have child elements if the refid attribute is set.
  `static void`
  `pushAndInvokeCircularReferenceCheck(DataType dt, Stack<Object> stk, Project p)`
  Allow DataTypes outside org.apache.tools.ant.types to indirectly call dieOnCircularReference on nested DataTypes.
  `protected void`
  `setChecked(boolean checked)`
  Set the flag that is used to indicate that circular references have been checked.
  `protected BuildException`
  `tooManyAttributes()`
  Creates an exception that indicates that refid has to be the only attribute if it is set.
  `String`
  `toString()`
  Basic DataType toString().

  ### Methods inherited from class ProjectComponent

  `getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject`
  Modifier and Type
  Method
  Description
  `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`
  `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`
  `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, wait, wait, wait`

- ## Constructor Details

  - ### RedirectorElement

    public RedirectorElement()

- ## Method Details

  - ### addConfiguredInputMapper

    public void addConfiguredInputMapper(Mapper inputMapper)
    Add the input file mapper.
    Parameters:
      `inputMapper` - `Mapper`.

  - ### addConfiguredOutputMapper

    public void addConfiguredOutputMapper(Mapper outputMapper)
    Add the output file mapper.
    Parameters:
      `outputMapper` - `Mapper`.

  - ### addConfiguredErrorMapper

    public void addConfiguredErrorMapper(Mapper errorMapper)
    Add the error file mapper.
    Parameters:
      `errorMapper` - `Mapper`.

  - ### setRefid

    public void setRefid(Reference r) throws BuildException
    Make this instance in effect a reference to another instance.

    You must not set another attribute or nest elements inside this element if you make it a reference.

    Overrides:
      `setRefid` in class `DataType`
    Parameters:
      `r` - the reference to use.
    Throws:
      `BuildException` - on error.

  - ### setInput

    public void setInput(File input)
    Set the input to use for the task.
    Parameters:
      `input` - the file from which input is read.

  - ### setInputString

    public void setInputString(String inputString)
    Set the string to use as input
    Parameters:
      `inputString` - the string which is used as the input source

  - ### setLogInputString

    public void setLogInputString(boolean logInputString)
    Set whether to include the value of the input string in log messages. Defaults to true.
    Parameters:
      `logInputString` - true or false.
    Since:
      Ant 1.7

  - ### setOutput

    public void setOutput(File out)
    File the output of the process is redirected to. If error is not redirected, it too will appear in the output.
    Parameters:
      `out` - the file to which output stream is written.

  - ### setOutputEncoding

    public void setOutputEncoding(String outputEncoding)
    Set the output encoding.
    Parameters:
      `outputEncoding` - `String`.

  - ### setErrorEncoding

    public void setErrorEncoding(String errorEncoding)
    Set the error encoding.
    Parameters:
      `errorEncoding` - `String`.

  - ### setInputEncoding

    public void setInputEncoding(String inputEncoding)
    Set the input encoding.
    Parameters:
      `inputEncoding` - `String`.

  - ### setLogError

    public void setLogError(boolean logError)
    Controls whether error output of exec is logged. This is only useful when output is being redirected and error output is desired in the Ant log.
    Parameters:
      `logError` - if true the standard error is sent to the Ant log system and not sent to output.

  - ### setError

    public void setError(File error)
    Set the file to which standard error is to be redirected.
    Parameters:
      `error` - the file to which error is to be written.

  - ### setOutputProperty

    public void setOutputProperty(String outputProperty)
    Property name whose value should be set to the output of the process.
    Parameters:
      `outputProperty` - the name of the property to be set with the task's output.

  - ### setAppend

    public void setAppend(boolean append)
    Whether output should be appended to or overwrite an existing file. Defaults to false.
    Parameters:
      `append` - if true output and error streams are appended to their respective files, if specified.

  - ### setAlwaysLog

    public void setAlwaysLog(boolean alwaysLog)
    If true, (error and non-error) output will be "teed", redirected as specified while being sent to Ant's logging mechanism as if no redirection had taken place. Defaults to false.
    Parameters:
      `alwaysLog` - `boolean`
    Since:
      Ant 1.6.3

  - ### setCreateEmptyFiles

    public void setCreateEmptyFiles(boolean createEmptyFiles)
    Whether output and error files should be created even when empty. Defaults to true.
    Parameters:
      `createEmptyFiles` - `boolean`.

  - ### setErrorProperty

    public void setErrorProperty(String errorProperty)
    Property name whose value should be set to the error of the process.
    Parameters:
      `errorProperty` - the name of the property to be set with the error output.

  - ### createInputFilterChain

    public FilterChain createInputFilterChain()
    Create a nested input `FilterChain`.
    Returns:
      `FilterChain`.

  - ### createOutputFilterChain

    public FilterChain createOutputFilterChain()
    Create a nested output `FilterChain`.
    Returns:
      `FilterChain`.

  - ### createErrorFilterChain

    public FilterChain createErrorFilterChain()
    Create a nested error `FilterChain`.
    Returns:
      `FilterChain`.

  - ### setBinaryOutput

    public void setBinaryOutput(boolean b)
    Whether to consider the output created by the process binary.

    Binary output will not be split into lines which may make error and normal output look mixed up when they get written to the same stream.

    Parameters:
      `b` - boolean
    Since:
      1.9.4

  - ### configure

    public void configure(Redirector redirector)
    Configure the specified `Redirector`.
    Parameters:
      `redirector` - `Redirector`.

  - ### configure

    public void configure(Redirector redirector, String sourcefile)
    Configure the specified `Redirector` for the specified sourcefile.
    Parameters:
      `redirector` - `Redirector`.
      `sourcefile` - `String`.

  - ### createMergeMapper

    protected Mapper createMergeMapper(File destfile)
    Create a merge mapper pointing to the specified destination file.
    Parameters:
      `destfile` - `File`
    Returns:
      `Mapper`.

  - ### toFileArray

    protected File[] toFileArray(String[] name)
    Return a `File[]` from the specified set of filenames.
    Parameters:
      `name` - `String[]`
    Returns:
      `File[]`.

  - ### dieOnCircularReference

    protected void dieOnCircularReference(Stack<Object> stk, Project p) throws BuildException
    Overrides the version of DataType to recurse on all DataType child elements that may have been added.
    Overrides:
      `dieOnCircularReference` in class `DataType`
    Parameters:
      `stk` - the stack of data types to use (recursively).
      `p` - the project to use to dereference the references.
    Throws:
      `BuildException` - on error.