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.

loadfile.html 3.1 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <html>
  2. <head>
  3. <title>LoadFile Task</title>
  4. </head>
  5. <body>
  6. <h2><a name="loadfile">LoadFile</a></h2>
  7. <h3>Description</h3>
  8. <p>
  9. Load a text file into a single property. Unless an encoding is specified,
  10. the encoding of the current locale is used. There is no explicit limit
  11. upon the size of the file which can be loaded, but loading very large
  12. files is not something anyone has yet explored. Because the file is
  13. converted to text
  14. </p>
  15. <h3>Parameters</h3>
  16. <table border="1" cellpadding="2" cellspacing="0">
  17. <tr>
  18. <td valign="top"><b>Attribute</b></td>
  19. <td valign="top"><b>Description</b></td>
  20. <td align="center" valign="top"><b>Required</b></td>
  21. </tr>
  22. <tr>
  23. <td valign="top">srcFile</td>
  24. <td valign="top">source file</td>
  25. <td valign="top" align="center">Yes</td>
  26. </tr>
  27. <tr>
  28. <td valign="top">property</td>
  29. <td valign="top">property to save to</td>
  30. <td valign="top" align="center">Yes</td>
  31. </tr>
  32. <tr>
  33. <td valign="top">encoding</td>
  34. <td valign="top">encoding to use when loading the file</td>
  35. <td align="center" valign="top">No</td>
  36. </tr>
  37. <tr>
  38. <td valign="top">failonerror</td>
  39. <td valign="top">Whether to halt the build on failure</td>
  40. <td align="center" valign="top">No, default "true"</td>
  41. </tr>
  42. <tr>
  43. <td valign="top">evaluateProperties</td>
  44. <td valign="top">flag to enable property evalation in the file</td>
  45. <td align="center" valign="top">No, default "false"</td>
  46. </tr>
  47. <tr>
  48. <td valign="top">makeOneLine</td>
  49. <td valign="top">flag to strip out newlines (but not spaces or
  50. tabs) from the file</td>
  51. <td align="center" valign="top">No, default "false"</td>
  52. </tr>
  53. </table>
  54. <p>
  55. The <tt>makeOneLine</tt> parameter enables you to use a file as an
  56. input to task parameters which expect single line input. It flattens
  57. the file by removing all carriage return and line feed characters,
  58. so that the file
  59. <pre>a
  60. b
  61. c
  62. </pre>would become "abc": you need spaces or
  63. commas at the end/start of line to stop alphanumeric characters
  64. being merged together.
  65. <h3>Examples</h3>
  66. <pre> &lt;loadfile property="message"
  67. srcFile="message.txt" / &gt;
  68. </pre>
  69. Load file message.txt into property "message"; an <tt>&lt;echo&gt;</tt>
  70. can print this.
  71. <pre> &lt;loadfile property="encoded-file"
  72. srcFile="loadfile.xml"
  73. encoding="ISO-8859-1" / &gt;
  74. </pre>
  75. Load a file using the latin-1 encoding
  76. <pre> &lt;loadfile
  77. property="optional.value"
  78. srcFile="optional.txt"
  79. failonerror="false" /&gt;
  80. </pre>
  81. Load a file, don't fail if it is missing (a message is printed, though)
  82. <pre> &lt;loadfile
  83. property="mail.recipients"
  84. srcFile="recipientlist.txt"
  85. makeOneLine="true" /&gt;
  86. </pre>
  87. load a property which can be used as a parameter for another task (in this case mail),
  88. merging lines to ensure this happens.
  89. <pre> &lt;loadfile
  90. property="system.configuration.xml"
  91. srcFile="configuration.xml"
  92. evaluateProperties="true" /&gt;
  93. </pre>
  94. load an XML file into a property, expanding all properties declared
  95. in the file in the process.
  96. <hr>
  97. <p align="center">Copyright &copy; 2001-2002 Apache Software Foundation. All rights
  98. Reserved.</p>
  99. </body>
  100. </html>