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

    java.lang.Object
      |
      +--org.apache.tools.ant.ProjectComponent
            |
            +--org.apache.tools.ant.Task
                  |
                  +--org.apache.tools.ant.taskdefs.Concat

public class Concat
extends Task

This class contains the 'concat' task, used to concatenate a series of files into a single stream. The destination of this stream may be the system console, or a file. The following is a sample invocation:

     <concat destfile="${build.dir}/index.xml"
       append="false">

       <fileset dir="${xml.root.dir}"
         includes="*.xml" />

     </concat>

Author:
  Derek Slager, Peter Reilly

Nested Class Summary
`static class` `Concat.TextElement` sub element points to a file or contains text

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
`Concat()`

Method Summary
`void` `addFilelist(FileList list)` List of files to concatenate.
`void` `addFileset(FileSet set)` Set of files to concatenate.
`void` `addFilterChain(FilterChain filterChain)` Adds a FilterChain.
`void` `addFooter(Concat.TextElement footer)` Add a footer to the concatenated output
`void` `addHeader(Concat.TextElement header)` Add a header to the concatenated output
`void` `addText(java.lang.String text)` This method adds text which appears in the 'concat' element.
`Path` `createPath()` Path of files to concatenate.
`void` `execute()` This method performs the concatenation.
`void` `reset()` Reset state to default.
`void` `setAppend(boolean append)` Sets the behavior when the destination file exists.
`void` `setDestfile(java.io.File destinationFile)` Sets the destination file, or uses the console if not specified.
`void` `setEncoding(java.lang.String encoding)` Sets the character encoding
`void` `setEol(FixCRLF.CrLf crlf)` Specify the end of line to find and to add if not present at end of each input file.
`void` `setFixLastLine(boolean fixLastLine)` Append line.separator to files that do not end with a line.separator, default false.
`void` `setForce(boolean force)` Force overwrite existing destination file
`void` `setOutputEncoding(java.lang.String outputEncoding)` Sets the character encoding for outputting
`void` `setWriter(java.io.Writer outputWriter)` set the output writer, this is to allow concat to be used as a nested element

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

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

### Concat

    public Concat()

Method Detail

### setDestfile

    public void setDestfile(java.io.File destinationFile)

  Sets the destination file, or uses the console if not specified.

  Parameters:
    `destinationFile` - the destination file

### setAppend

    public void setAppend(boolean append)

  Sets the behavior when the destination file exists. If set to `true` the stream data will be appended to the existing file, otherwise the existing file will be overwritten. Defaults to `false`.

  Parameters:
    `append` - if true append to the file.

### setEncoding

    public void setEncoding(java.lang.String encoding)

  Sets the character encoding

  Parameters:
    `encoding` - the encoding of the input stream and unless outputencoding is set, the outputstream.

### setOutputEncoding

    public void setOutputEncoding(java.lang.String outputEncoding)

  Sets the character encoding for outputting

  Parameters:
    `outputEncoding` - the encoding for the output file
  Since:
    Ant 1.6

### setForce

    public void setForce(boolean force)

  Force overwrite existing destination file

  Parameters:
    `force` - if true always overwrite, otherwise only overwrite if the output file is older any of the input files.
  Since:
    Ant 1.6

### createPath

    public Path createPath()

  Path of files to concatenate.

  Returns:
    the path used for concatenating
  Since:
    Ant 1.6

### addFileset

    public void addFileset(FileSet set)

  Set of files to concatenate.

  Parameters:
    `set` - the set of files

### addFilelist

    public void addFilelist(FileList list)

  List of files to concatenate.

  Parameters:
    `list` - the list of files

### addFilterChain

    public void addFilterChain(FilterChain filterChain)

  Adds a FilterChain.

  Parameters:
    `filterChain` - a filterchain to filter the concatenated input
  Since:
    Ant 1.6

### addText

    public void addText(java.lang.String text)

  This method adds text which appears in the 'concat' element.

  Parameters:
    `text` - the text to be concated.

### addHeader

    public void addHeader(Concat.TextElement header)

  Add a header to the concatenated output

  Parameters:
    `header` - the header
  Since:
    Ant 1.6

### addFooter

    public void addFooter(Concat.TextElement footer)

  Add a footer to the concatenated output

  Parameters:
    `footer` - the footer
  Since:
    Ant 1.6

### setFixLastLine

    public void setFixLastLine(boolean fixLastLine)

  Append line.separator to files that do not end with a line.separator, default false.

  Parameters:
    `fixLastLine` - if true make sure each input file has new line on the concatenated stream
  Since:
    Ant 1.6

### setEol

    public void setEol(FixCRLF.CrLf crlf)

  Specify the end of line to find and to add if not present at end of each input file. This attribute is used in conjunction with fixlastline.

  Parameters:
    `crlf` - the type of new line to add - cr, mac, lf, unix, crlf, or dos
  Since:
    Ant 1.6

### setWriter

    public void setWriter(java.io.Writer outputWriter)

  set the output writer, this is to allow concat to be used as a nested element

  Parameters:
    `outputWriter` - the output writer
  Since:
    Ant 1.6

### execute

    public void execute()

  This method performs the concatenation.

  Overrides:
    `execute` in class `Task`

### reset

    public void reset()

  Reset state to default.

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