📜  Apache Ant Concat任务

📅  最后修改于: 2020-12-26 13:50:15             🧑  作者: Mango

Apache Ant Concat任务

并置用于将一个或多个文件合并为单个文件。如果不存在新文件,除非资源列表为空且ignoreempty为true,否则将创建一个新文件。

从Apache Ant 1.7.1开始,此任务可以用作资源集合,它将仅返回一个资源。

资源集合用于选择要串联的资源。没有单一属性可以指定要连接文件的单个资源。

Apache Ant Concat任务属性

Attribute Description Required
destfile The destination file for the concatenated stream. No
append It specifies whether or not the file specified by destfile should be appended. No
force It specifies whether or not the file specified by destfile should be written. No
overwrite It specifies whether or not the file specified by destfile should be written. No
forceReadOnly It overwrites read-only destination files. No
encoding It specifies the encoding for the input files. No
outputencoding The encoding to use when writing the output file. No
fixlastline It specifies whether or not to check if each file concatenated is terminated by a new line. No
eol It specifies what the end of line character are for use by the fixlastline attribute. No
binary If this attribute is set to true, the task concatenates the files in a byte by byte fashion. No
ignoreempty Specifies whether or not the file specified by destfile should be created if the source resource list is empty. No; defaults to true
resourcename Specifies the name reported if this task is exposed as a resource. No

Apache Ant Concat示例

将字符串连接到文件:

Hello, World!

将一系列文件连接到控制台: