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.

unpack.html 3.8 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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>GUnzip/BUnzip2 Task</title>
  20. </head>
  21. <body>
  22. <h2><a name="unpack">GUnzip/BUnzip2</a></h2>
  23. <h3>Description</h3>
  24. <p>Expands a resource packed using GZip or BZip2.</p>
  25. <p>If <i>dest</i> is a directory the name of the destination file is
  26. the same as <i>src</i> (with the &quot;.gz&quot; or &quot;.bz2&quot;
  27. extension removed if present). If <i>dest</i> is omitted, the parent
  28. dir of <i>src</i> is taken. The file is only expanded if the source
  29. resource is newer than the destination file, or when the destination file
  30. does not exist.</p>
  31. <h3>Parameters</h3>
  32. <table border="1" cellpadding="2" cellspacing="0">
  33. <tr>
  34. <td valign="top"><b>Attribute</b></td>
  35. <td valign="top"><b>Description</b></td>
  36. <td align="center" valign="top"><b>Required</b></td>
  37. </tr>
  38. <tr>
  39. <td valign="top">src</td>
  40. <td valign="top">the file to expand.</td>
  41. <td align="center" valign="top">Yes, or a nested resource collection.</td>
  42. </tr>
  43. <tr>
  44. <td valign="top">dest</td>
  45. <td valign="top">the destination file or directory.</td>
  46. <td align="center" valign="top">No</td>
  47. </tr>
  48. </table>
  49. <h3>Parameters specified as nested elements</h3>
  50. <h4>any <a href="../CoreTypes/resources.html">resource</a> or single element
  51. resource collection</h4>
  52. <p>The specified resource will be used as src.</p>
  53. <h3>Examples</h3>
  54. <blockquote><pre>
  55. &lt;gunzip src=&quot;test.tar.gz&quot;/&gt;
  56. </pre></blockquote>
  57. <p>expands <i>test.tar.gz</i> to <i>test.tar</i></p>
  58. <blockquote><pre>
  59. &lt;bunzip2 src=&quot;test.tar.bz2&quot;/&gt;
  60. </pre></blockquote>
  61. <p>expands <i>test.tar.bz2</i> to <i>test.tar</i></p>
  62. <blockquote><pre>
  63. &lt;gunzip src=&quot;test.tar.gz&quot; dest=&quot;test2.tar&quot;/&gt;
  64. </pre></blockquote>
  65. <p>expands <i>test.tar.gz</i> to <i>test2.tar</i></p>
  66. <blockquote><pre>
  67. &lt;gunzip src=&quot;test.tar.gz&quot; dest=&quot;subdir&quot;/&gt;
  68. </pre></blockquote>
  69. <p>expands <i>test.tar.gz</i> to <i>subdir/test.tar</i> (assuming
  70. subdir is a directory).</p>
  71. <blockquote><pre>
  72. &lt;gunzip dest=&quot;.&quot;&gt;
  73. &lt;url url="http://example.org/archive.tar.gz"/&gt;
  74. &lt;/gunzip&gt;
  75. </pre></blockquote>
  76. <p>downloads <i>http://example.org/archive.tar.gz</i> and expands it
  77. to <i>archive.tar</i> in the project's basedir on the fly.</p>
  78. <h3>Related tasks</h3>
  79. <pre>
  80. &lt;gunzip src="some-archive.gz" dest="some-dest-dir"/&gt;
  81. </pre>
  82. is identical to
  83. <pre>
  84. &lt;copy todir="some-dest-dir"&gt;
  85. &lt;gzipresource&gt;
  86. &lt;file file="some-archive.gz"/&gt;
  87. &lt;/gzipresource&gt;
  88. &lt;mapper type="glob" from="*.gz" to="*"/&gt;
  89. &lt;/copy&gt;
  90. </pre>
  91. <p>The same is also true for <code>&lt;bunzip2&gt;</code> and
  92. <code>&lt;bzip2resource&gt;</code>. <code>&lt;copy&gt;</code> offers
  93. additional features like <a
  94. href="../CoreTypes/filterchains.html">filtering files</a> on the fly,
  95. allowing a file to be mapped to multiple destinations, preserving the
  96. last modified time or a configurable file system timestamp
  97. granularity.</p>
  98. </body>
  99. </html>