Package 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
- All Implemented Interfaces:
- Cloneable,- Iterable<Resource>,- ResourceCollection
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 Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classsub element points to a file or contains text
- 
Field SummaryFields inherited from class org.apache.tools.ant.ProjectComponentdescription, location, project
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdd an arbitrary ResourceCollection.voidaddFilelist(FileList list) List of files to concatenate.voidaddFileset(FileSet set) Set of files to concatenate.voidaddFilterChain(FilterChain filterChain) Adds a FilterChain.voidaddFooter(Concat.TextElement footerToAdd) Add a footer to the concatenated outputvoidaddHeader(Concat.TextElement headerToAdd) Add a header to the concatenated outputvoidThis method adds text which appears in the 'concat' element.Path of files to concatenate.voidexecute()Execute the concat task.booleanImplement ResourceCollection.iterator()Implement ResourceCollection.voidreset()Reset state to default.voidsetAppend(boolean append) Sets the behavior when the destination exists.voidsetBinary(boolean binary) Set the binary attribute.voidSet the resource to write to.voidsetDestfile(File destinationFile) Sets the destination file, or uses the console if not specified.voidsetEncoding(String encoding) Sets the character encodingvoidsetEol(FixCRLF.CrLf crlf) Specify the end of line to find and to add if not present at end of each input file.voidsetFilterBeforeConcat(boolean filterBeforeConcat) Set the filterBeforeConcat attribute.voidsetFixLastLine(boolean fixLastLine) Append line.separator to files that do not end with a line.separator, default false.voidsetForce(boolean forceOverwrite) Deprecated.use #setOverwrite insteadvoidsetForceReadOnly(boolean f) Whether read-only destinations will be overwritten.voidsetIgnoreEmpty(boolean ignoreEmpty) Sets the behavior when no source resource files are available.voidsetOutputEncoding(String outputEncoding) Sets the character encoding for outputtingvoidsetOverwrite(boolean forceOverwrite) Force overwrite existing destination filevoidsetResourceName(String resourceName) Set the name that will be reported by the exposedResource.voidSet the output writer.intsize()Implement ResourceCollection.Methods inherited from class org.apache.tools.ant.TaskbindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskTypeMethods inherited from class org.apache.tools.ant.ProjectComponentclone, getDescription, getLocation, getProject, setDescription, setLocation, setProjectMethods inherited from class java.lang.Objectequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.IterableforEach, spliteratorMethods inherited from interface org.apache.tools.ant.types.ResourceCollectionisEmpty, stream
- 
Constructor Details- 
Concatpublic Concat()Construct a new Concat task.
 
- 
- 
Method Details- 
resetpublic void reset()Reset state to default.
- 
setDestfileSets the destination file, or uses the console if not specified.- Parameters:
- destinationFile- the destination file
 
- 
setDestSet the resource to write to.- Parameters:
- dest- the Resource to write to.
- Since:
- Ant 1.8
 
- 
setAppendpublic void setAppend(boolean append) Sets the behavior when the destination exists. If set totruethe task will append the stream data anAppendableresource; otherwise existing content will be overwritten. Defaults tofalse.- Parameters:
- append- if true append output.
 
- 
setEncodingSets the character encoding- Parameters:
- encoding- the encoding of the input stream and unless outputencoding is set, the outputstream.
 
- 
setOutputEncodingSets the character encoding for outputting- Parameters:
- outputEncoding- the encoding for the output file
- Since:
- Ant 1.6
 
- 
setForceDeprecated.use #setOverwrite insteadForce overwrite existing destination file- Parameters:
- forceOverwrite- if true always overwrite, otherwise only overwrite if the output file is older any of the input files.
- Since:
- Ant 1.6
 
- 
setOverwritepublic void setOverwrite(boolean forceOverwrite) Force overwrite existing destination file- Parameters:
- forceOverwrite- if true always overwrite, otherwise only overwrite if the output file is older any of the input files.
- Since:
- Ant 1.8.2
 
- 
setForceReadOnlypublic void setForceReadOnly(boolean f) Whether read-only destinations will be overwritten.Defaults to false - Parameters:
- f- boolean
- Since:
- Ant 1.8.2
 
- 
setIgnoreEmptypublic void setIgnoreEmpty(boolean ignoreEmpty) Sets the behavior when no source resource files are available. If set tofalsethe destination file will always be created. Defaults totrue.- Parameters:
- ignoreEmpty- if false, honour destination file creation.
- Since:
- Ant 1.8.0
 
- 
setResourceNameSet the name that will be reported by the exposedResource.- Parameters:
- resourceName- to set
- Since:
- Ant 1.8.3
 
- 
createPathPath of files to concatenate.- Returns:
- the path used for concatenating
- Since:
- Ant 1.6
 
- 
addFilesetSet of files to concatenate.- Parameters:
- set- the set of files
 
- 
addFilelistList of files to concatenate.- Parameters:
- list- the list of files
 
- 
addAdd an arbitrary ResourceCollection.- Parameters:
- c- the ResourceCollection to add.
- Since:
- Ant 1.7
 
- 
addFilterChainAdds a FilterChain.- Parameters:
- filterChain- a filterchain to filter the concatenated input
- Since:
- Ant 1.6
 
- 
addTextThis method adds text which appears in the 'concat' element.- Parameters:
- text- the text to be concatenated.
 
- 
addHeaderAdd a header to the concatenated output- Parameters:
- headerToAdd- the header
- Since:
- Ant 1.6
 
- 
setFixLastLinepublic 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
 
- 
setEolSpecify 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
 
- 
setWriterSet the output writer. This is to allow concat to be used as a nested element.- Parameters:
- outputWriter- the output writer.
- Since:
- Ant 1.6
 
- 
setBinarypublic void setBinary(boolean binary) Set the binary attribute. If true, concat will concatenate the files byte for byte. This mode does not allow any filtering or other modifications to the input streams. The default value is false.- Parameters:
- binary- if true, enable binary mode.
- Since:
- Ant 1.6.2
 
- 
setFilterBeforeConcatpublic void setFilterBeforeConcat(boolean filterBeforeConcat) Set the filterBeforeConcat attribute. If true, concat will filter each input through the filterchain before concatenating the results. This allows to e.g. use the FileTokenizer to tokenize each input.- Parameters:
- filterBeforeConcat- if true, filter each input before concatenation
- Since:
- Ant 1.10.10
 
- 
executepublic void execute()Execute the concat task.
- 
iteratorImplement ResourceCollection.
- 
sizepublic int size()Implement ResourceCollection.- Specified by:
- sizein interface- ResourceCollection
- Returns:
- 1.
 
- 
isFilesystemOnlypublic boolean isFilesystemOnly()Implement ResourceCollection.- Specified by:
- isFilesystemOnlyin interface- ResourceCollection
- Returns:
- false.
 
 
-