You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

length.html 4.2 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <!--
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. -->
  15. <html>
  16. <head>
  17. <meta http-equiv="Content-Language" content="en-us">
  18. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  19. <title>Length Task</title>
  20. </head>
  21. <body>
  22. <h2>Length</h2>
  23. <h3>Description</h3>
  24. <p>Display or set a property containing length information for
  25. a string, a file, or one or more nested
  26. <a href="../CoreTypes/resources.html#collection">Resource Collection</a>s.
  27. Can also be used as a condition. <b>Since Ant 1.6.3</b></p>
  28. <h3>Parameters</h3>
  29. <table border="1" cellpadding="2" cellspacing="0">
  30. <tr>
  31. <td valign="top"><b>Attribute</b></td>
  32. <td valign="top"><b>Description</b></td>
  33. <td align="center" valign="top"><b>Required</b></td>
  34. </tr>
  35. <tr>
  36. <td valign="top">property</td>
  37. <td valign="top">The property to set. If omitted
  38. the results are written to the log. Ignored when
  39. processing as a condition.</td>
  40. <td valign="top" align="center">No</td>
  41. </tr>
  42. <tr>
  43. <td valign="top">file</td>
  44. <td valign="top">Single file whose length to report.</td>
  45. <td valign="top" align="center" rowspan="2">One of these,
  46. or one or more nested filesets</td>
  47. </tr>
  48. <tr>
  49. <td valign="top">string</td>
  50. <td valign="top">The string whose length to report.</td>
  51. </tr>
  52. <tr>
  53. <td valign="top">mode</td>
  54. <td valign="top">File length mode; when &quot;all&quot; the resulting
  55. value is the sum of all included resources' lengths; when &quot;each&quot;
  56. the task outputs the absolute path and length of each included resource,
  57. one per line. Ignored when processing as a condition.</td>
  58. <td valign="top" align="center">No; default is &quot;all&quot;</td>
  59. </tr>
  60. <tr>
  61. <td valign="top">trim</td>
  62. <td valign="top">Whether to trim when operating on a string.</td>
  63. <td valign="top" align="center">No; only valid when string is set</td>
  64. </tr>
  65. <tr>
  66. <td valign="top">length</td>
  67. <td valign="top">Comparison length for processing as a condition.</td>
  68. <td valign="top" align="center">Yes, in condition mode</td>
  69. </tr>
  70. <tr>
  71. <td valign="top">when</td>
  72. <td valign="top">Comparison type: "equal", "eq", "greater", "gt", "less",
  73. "lt", "ge" (greater or equal), "ne" (not equal), "le" (less or equal)
  74. for use when operating as a condition.</td>
  75. <td valign="top" align="center">No; default is "equal"</td>
  76. </tr>
  77. </table>
  78. <h3>Parameters specified as nested elements</h3>
  79. <h4>Resource Collections</h4>
  80. <p>You can include resources via nested
  81. <a href="../CoreTypes/resources.html#collection">Resource Collection</a>s.</p>
  82. <h3>Examples</h3>
  83. <pre>&lt;length string=&quot;foo&quot; property=&quot;length.foo&quot; /&gt;
  84. </pre>
  85. <p>Stores the length of the string &quot;foo&quot; in the property named
  86. <i>length.foo</i>.</p>
  87. <pre>&lt;length file=&quot;bar&quot; property=&quot;length.bar&quot; /&gt;
  88. </pre>
  89. <p>Stores the length of file &quot;bar&quot; in the property named
  90. <i>length.bar</i>.</p>
  91. <pre>
  92. &lt;length property=&quot;length&quot; mode=&quot;each&quot;&gt;
  93. &lt;fileset dir=&quot;.&quot; includes=&quot;foo,bar&quot;/&gt;
  94. &lt;/length&gt;
  95. </pre>
  96. <p>Writes the file paths of <i>foo</i> and <i>bar</i> and their length into
  97. the property <i>length</i>.</p>
  98. <pre>
  99. &lt;length property=&quot;length&quot; mode=&quot;all&quot;&gt;
  100. &lt;fileset dir=&quot;.&quot; includes=&quot;foo,bar&quot;/&gt;
  101. &lt;/length&gt;
  102. </pre>
  103. <p>Adds the length of <i>foo</i> and <i>bar</i> and stores the result in property <i>length</i>.</p>
  104. </body>
  105. </html>