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 4.2 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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/UnXZ</a></h2>
  23. <h3>Description</h3>
  24. <p>Expands a resource packed using GZip, BZip2 or XZ.</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;, &quot;.bz2&quot; or &quot;.xz&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. <p>XZ compression support has been added with Apache Ant 1.10.1 and
  32. depends on external libraries not included in the Ant distribution.
  33. See <a href="../install.html#librarydependencies">Library
  34. Dependencies</a> for more information.</p>
  35. <h3>Parameters</h3>
  36. <table border="1" cellpadding="2" cellspacing="0">
  37. <tr>
  38. <td valign="top"><b>Attribute</b></td>
  39. <td valign="top"><b>Description</b></td>
  40. <td align="center" valign="top"><b>Required</b></td>
  41. </tr>
  42. <tr>
  43. <td valign="top">src</td>
  44. <td valign="top">the file to expand.</td>
  45. <td align="center" valign="top">Yes, or a nested resource collection.</td>
  46. </tr>
  47. <tr>
  48. <td valign="top">dest</td>
  49. <td valign="top">the destination file or directory.</td>
  50. <td align="center" valign="top">No</td>
  51. </tr>
  52. </table>
  53. <h3>Parameters specified as nested elements</h3>
  54. <h4>any <a href="../Types/resources.html">resource</a> or single element
  55. resource collection</h4>
  56. <p>The specified resource will be used as src.</p>
  57. <h3>Examples</h3>
  58. <blockquote><pre>
  59. &lt;gunzip src=&quot;test.tar.gz&quot;/&gt;
  60. </pre></blockquote>
  61. <p>expands <i>test.tar.gz</i> to <i>test.tar</i></p>
  62. <blockquote><pre>
  63. &lt;bunzip2 src=&quot;test.tar.bz2&quot;/&gt;
  64. </pre></blockquote>
  65. <p>expands <i>test.tar.bz2</i> to <i>test.tar</i></p>
  66. <blockquote><pre>
  67. &lt;uncz src=&quot;test.tar.xz&quot;/&gt;
  68. </pre></blockquote>
  69. <p>expands <i>test.tar.xz</i> to <i>test.tar</i></p>
  70. <blockquote><pre>
  71. &lt;gunzip src=&quot;test.tar.gz&quot; dest=&quot;test2.tar&quot;/&gt;
  72. </pre></blockquote>
  73. <p>expands <i>test.tar.gz</i> to <i>test2.tar</i></p>
  74. <blockquote><pre>
  75. &lt;gunzip src=&quot;test.tar.gz&quot; dest=&quot;subdir&quot;/&gt;
  76. </pre></blockquote>
  77. <p>expands <i>test.tar.gz</i> to <i>subdir/test.tar</i> (assuming
  78. subdir is a directory).</p>
  79. <blockquote><pre>
  80. &lt;gunzip dest=&quot;.&quot;&gt;
  81. &lt;url url="http://example.org/archive.tar.gz"/&gt;
  82. &lt;/gunzip&gt;
  83. </pre></blockquote>
  84. <p>downloads <i>http://example.org/archive.tar.gz</i> and expands it
  85. to <i>archive.tar</i> in the project's basedir on the fly.</p>
  86. <h3>Related tasks</h3>
  87. <pre>
  88. &lt;gunzip src="some-archive.gz" dest="some-dest-dir"/&gt;
  89. </pre>
  90. is identical to
  91. <pre>
  92. &lt;copy todir="some-dest-dir"&gt;
  93. &lt;gzipresource&gt;
  94. &lt;file file="some-archive.gz"/&gt;
  95. &lt;/gzipresource&gt;
  96. &lt;mapper type="glob" from="*.gz" to="*"/&gt;
  97. &lt;/copy&gt;
  98. </pre>
  99. <p>The same is also true for <code>&lt;bunzip2&gt;</code> and
  100. <code>&lt;bzip2resource&gt;</code> or <code>%lt;unxz&gt;</code>
  101. and <code>%lt;xzresource&gt;</code>. <code>&lt;copy&gt;</code> offers
  102. additional features like <a href="../Types/filterchain.html">filtering
  103. files</a> on the fly, allowing a file to be mapped to multiple
  104. destinations, preserving the last modified time or a configurable file
  105. system timestamp granularity.</p>
  106. </body>
  107. </html>