Display or set a property containing length information for a string, a file, or one or more nested Resource Collections. Can also be used as a condition. Since Apache Ant 1.6.3
|property||The property to set. If omitted the results are written to the log. Ignored when processing as a condition.||No|
|file||Single file whose length to report.||One of these, or one or more nested filesets|
|resource||Single resource whose length to report (using extended properties handling). Since Ant 1.8.1|
|string||The string whose length to report.|
|mode||File length mode; when "all" the resulting value is the sum of all included resources' lengths; when "each" the task outputs the absolute path and length of each included resource, one per line. Ignored when processing as a condition.||No; default is "all"|
|trim||Whether to trim when operating on a string. Default false.||No; only valid when string is set|
|length||Comparison length for processing as a condition.||Yes, in condition mode|
|when||Comparison type: "equal", "eq", "greater", "gt", "less", "lt", "ge" (greater or equal), "ne" (not equal), "le" (less or equal) for use when operating as a condition.||No; default is "equal"|
You can include resources via nested Resource Collections.
<length string="foo" property="length.foo" />
Stores the length of the string "foo" in the property named length.foo.
<length file="bar" property="length.bar" />
Stores the length of file "bar" in the property named length.bar.
<length property="length" mode="each"> <fileset dir="." includes="foo,bar"/> </length>
Writes the file paths of foo and bar and their length into the property length.
<length property="length" mode="all"> <fileset dir="." includes="foo,bar"/> </length>
Adds the length of foo and bar and stores the result in property length.