Top Description Inners Fields Constructors Methods
org.apache.tools.ant.taskdefs

public Class Concat

extends Task
implements ResourceCollection
Class Inheritance
All Implemented Interfaces
org.apache.tools.ant.types.ResourceCollection, java.lang.Iterable
Imports
java.io.BufferedReader, .File, .FileReader, .IOException, .InputStream, .InputStreamReader, .Reader, .StringReader, .Writer, java.nio.file.Files, java.util.Arrays, .Collections, .Iterator, .Vector, org.apache.tools.ant.BuildException, .Project, .ProjectComponent, .Task, org.apache.tools.ant.filters.util.ChainReaderHelper, org.apache.tools.ant.types.FileList, .FileSet, .FilterChain, .Path, .Resource, .ResourceCollection, org.apache.tools.ant.types.resources.FileResource, .Intersect, .LogOutputResource, .Resources, .Restrict, .StringResource, org.apache.tools.ant.types.resources.selectors.Exists, .Not, .ResourceSelector, org.apache.tools.ant.types.selectors.SelectorUtils, org.apache.tools.ant.util.ConcatResourceInputStream, .FileUtils, .ReaderInputStream, .ResourceUtils

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>

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private class
Concat.LastLineFixingReader

This class reads a Reader and ensures it ends with the desired linebreak

private class
Concat.MultiReader<S>

This class reads from each of the source files in turn.

private static interface
public static class
Concat.TextElement

sub element points to a file or contains text

Field Summary

Modifier and TypeField and Description
private boolean
append

Whether or not the stream should be appended if the destination file exists.

private boolean
binary

Stores the binary attribute

private static final int
private Resource
dest

The destination of the stream.

private String
encoding

Stores the input file encoding.

private String
eolString

endofline for fixlast line

private static final ResourceSelector
private static final FileUtils
private boolean
filterBeforeConcat

Stores the filterBeforeConcat attribute

private Vector<FilterChain>
filterChains

for filtering the concatenated

private boolean
fixLastLine

add missing line.separator to files

private Concat.TextElement
footer

String to place at the start of the concatenated stream

private boolean
force

overwrite read-only files

private boolean
forceOverwrite

ignore dates on input files

private Concat.TextElement
header

String to place at the end of the concatenated stream

private Concat.ReaderFactory<Reader>
private boolean
ignoreEmpty

whether to not create dest if no source files are available

private static final ResourceSelector
private String
outputEncoding

Stores the output file encoding.

private Writer
outputWriter

outputwriter

private Resources
rc

Stores a collection of file sets and/or file lists, used to select multiple files for concatenation.

private String
resourceName

exposed resource name

private Concat.ReaderFactory<Resource>
private StringBuffer
textBuffer

This buffer stores the text within the 'concat' element.

Inherited from org.apache.tools.ant.Task:
targettaskNametaskTypewrapper

Constructor Summary

AccessConstructor and Description
public
Concat()

Construct a new Concat task.

Method Summary

Modifier and TypeMethod and Description
public void
add(ResourceCollection
the ResourceCollection to add.
c
)

Add an arbitrary ResourceCollection.

public void
addFilelist(FileList
the list of files
list
)

List of files to concatenate.

public void
addFileset(FileSet
the set of files
set
)

Set of files to concatenate.

public void
addFilterChain(FilterChain
a filterchain to filter the concatenated input
filterChain
)

Adds a FilterChain.

public void
addFooter(Concat.TextElement
the footer
footerToAdd
)

Add a footer to the concatenated output

public void
addHeader(Concat.TextElement
the header
headerToAdd
)

Add a header to the concatenated output

public void
addText(String
the text to be concatenated.
text
)

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

public Path

Returns:

the path used for concatenating
createPath
()

Path of files to concatenate.

public void
execute()

Overrides org.apache.tools.ant.Task.execute.

Execute the concat task.
private Reader
private ResourceCollection
getResources()

Get the resources to concatenate.

public boolean

Returns:

false.
isFilesystemOnly
()

Implements org.apache.tools.ant.types.ResourceCollection.isFilesystemOnly.

Implement ResourceCollection.
private boolean
public Iterator<Resource>

Returns:

Iterator<Resource>.
iterator
()

Implements java.lang.Iterable.iterator.

Implement ResourceCollection.
public void
reset()

Reset state to default.

private void
sanitizeText()

Treat empty nested text as no text.

public void
setAppend(boolean
if true append output.
append
)

Sets the behavior when the destination exists.

public void
setBinary(boolean
if true, enable binary mode.
binary
)

Set the binary attribute.

public void
setDest(Resource
the Resource to write to.
dest
)

Set the resource to write to.

public void
setDestfile(File
the destination file
destinationFile
)

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

public void
setEncoding(String
the encoding of the input stream and unless outputencoding is set, the outputstream.
encoding
)

Sets the character encoding

public void
setEol(FixCRLF.CrLf
the type of new line to add - cr, mac, lf, unix, crlf, or dos
crlf
)

Specify the end of line to find and to add if not present at end of each input file.

public void
setFilterBeforeConcat(final boolean
if true, filter each input before concatenation
filterBeforeConcat
)

Set the filterBeforeConcat attribute.

public void
setFixLastLine(boolean
if true make sure each input file has new line on the concatenated stream
fixLastLine
)

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

public void
setForce(boolean
if true always overwrite, otherwise only overwrite if the output file is older any of the input files.
forceOverwrite
)

Deprecated use #setOverwrite instead
Force overwrite existing destination file
public void
setForceReadOnly(boolean
boolean
f
)

Whether read-only destinations will be overwritten.

public void
setIgnoreEmpty(boolean
if false, honour destination file creation.
ignoreEmpty
)

Sets the behavior when no source resource files are available.

public void
setOutputEncoding(String
the encoding for the output file
outputEncoding
)

Sets the character encoding for outputting

public void
setOverwrite(boolean
if true always overwrite, otherwise only overwrite if the output file is older any of the input files.
forceOverwrite
)

Force overwrite existing destination file

public void
setResourceName(String
to set
resourceName
)

Set the name that will be reported by the exposed Resource.

public void
setWriter(Writer
the output writer.
outputWriter
)

Set the output writer.

public int

Returns:

1.
size
()

Implements org.apache.tools.ant.types.ResourceCollection.size.

Implement ResourceCollection.
private void
validate()

Validate configuration options.

Inherited from org.apache.tools.ant.Task:
bindToOwnergetOwningTargetgetRuntimeConfigurableWrappergetTaskNamegetTaskTypegetWrapperhandleErrorFlushhandleErrorOutputhandleFlushhandleInputhandleOutputinitisInvalidloglogloglogmaybeConfigureperformreconfiguresetOwningTargetsetRuntimeConfigurableWrappersetTaskNamesetTaskType