IOUtils.html 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <!-- NewPage -->
  3. <html lang="de">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  6. <title>IOUtils (Apache Commons Compress 1.13 API)</title>
  7. <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
  8. </head>
  9. <body>
  10. <script type="text/javascript"><!--
  11. try {
  12. if (location.href.indexOf('is-external=true') == -1) {
  13. parent.document.title="IOUtils (Apache Commons Compress 1.13 API)";
  14. }
  15. }
  16. catch(err) {
  17. }
  18. //-->
  19. </script>
  20. <noscript>
  21. <div>JavaScript is disabled on your browser.</div>
  22. </noscript>
  23. <!-- ========= START OF TOP NAVBAR ======= -->
  24. <div class="topNav"><a name="navbar_top">
  25. <!-- -->
  26. </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
  27. <!-- -->
  28. </a>
  29. <ul class="navList" title="Navigation">
  30. <li><a href="../../../../../overview-summary.html">Overview</a></li>
  31. <li><a href="package-summary.html">Package</a></li>
  32. <li class="navBarCell1Rev">Class</li>
  33. <li><a href="class-use/IOUtils.html">Use</a></li>
  34. <li><a href="package-tree.html">Tree</a></li>
  35. <li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
  36. <li><a href="../../../../../index-all.html">Index</a></li>
  37. <li><a href="../../../../../help-doc.html">Help</a></li>
  38. </ul>
  39. </div>
  40. <div class="subNav">
  41. <ul class="navList">
  42. <li><a href="../../../../../org/apache/commons/compress/utils/FlushShieldFilterOutputStream.html" title="class in org.apache.commons.compress.utils"><span class="strong">Prev Class</span></a></li>
  43. <li><a href="../../../../../org/apache/commons/compress/utils/Iterators.html" title="class in org.apache.commons.compress.utils"><span class="strong">Next Class</span></a></li>
  44. </ul>
  45. <ul class="navList">
  46. <li><a href="../../../../../index.html?org/apache/commons/compress/utils/IOUtils.html" target="_top">Frames</a></li>
  47. <li><a href="IOUtils.html" target="_top">No Frames</a></li>
  48. </ul>
  49. <ul class="navList" id="allclasses_navbar_top">
  50. <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
  51. </ul>
  52. <div>
  53. <script type="text/javascript"><!--
  54. allClassesLink = document.getElementById("allclasses_navbar_top");
  55. if(window==top) {
  56. allClassesLink.style.display = "block";
  57. }
  58. else {
  59. allClassesLink.style.display = "none";
  60. }
  61. //-->
  62. </script>
  63. </div>
  64. <div>
  65. <ul class="subNavList">
  66. <li>Summary:&nbsp;</li>
  67. <li>Nested&nbsp;|&nbsp;</li>
  68. <li>Field&nbsp;|&nbsp;</li>
  69. <li>Constr&nbsp;|&nbsp;</li>
  70. <li><a href="#method_summary">Method</a></li>
  71. </ul>
  72. <ul class="subNavList">
  73. <li>Detail:&nbsp;</li>
  74. <li>Field&nbsp;|&nbsp;</li>
  75. <li>Constr&nbsp;|&nbsp;</li>
  76. <li><a href="#method_detail">Method</a></li>
  77. </ul>
  78. </div>
  79. <a name="skip-navbar_top">
  80. <!-- -->
  81. </a></div>
  82. <!-- ========= END OF TOP NAVBAR ========= -->
  83. <!-- ======== START OF CLASS DATA ======== -->
  84. <div class="header">
  85. <div class="subTitle">org.apache.commons.compress.utils</div>
  86. <h2 title="Class IOUtils" class="title">Class IOUtils</h2>
  87. </div>
  88. <div class="contentContainer">
  89. <ul class="inheritance">
  90. <li><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
  91. <li>
  92. <ul class="inheritance">
  93. <li>org.apache.commons.compress.utils.IOUtils</li>
  94. </ul>
  95. </li>
  96. </ul>
  97. <div class="description">
  98. <ul class="blockList">
  99. <li class="blockList">
  100. <hr>
  101. <br>
  102. <pre>public final class <a href="../../../../../src-html/org/apache/commons/compress/utils/IOUtils.html#line.34">IOUtils</a>
  103. extends <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
  104. <div class="block">Utility functions</div>
  105. <dl><dt><span class="strong">This class is immutable</span></dt>
  106. <dd>(has mutable data but it is write-only)</dd></dl>
  107. </li>
  108. </ul>
  109. </div>
  110. <div class="summary">
  111. <ul class="blockList">
  112. <li class="blockList">
  113. <!-- ========== METHOD SUMMARY =========== -->
  114. <ul class="blockList">
  115. <li class="blockList"><a name="method_summary">
  116. <!-- -->
  117. </a>
  118. <h3>Method Summary</h3>
  119. <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
  120. <caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
  121. <tr>
  122. <th class="colFirst" scope="col">Modifier and Type</th>
  123. <th class="colLast" scope="col">Method and Description</th>
  124. </tr>
  125. <tr class="altColor">
  126. <td class="colFirst"><code>static void</code></td>
  127. <td class="colLast"><code><strong><a href="../../../../../org/apache/commons/compress/utils/IOUtils.html#closeQuietly(java.io.Closeable)">closeQuietly</a></strong>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io">Closeable</a>&nbsp;c)</code>
  128. <div class="block">Closes the given Closeable and swallows any IOException that may occur.</div>
  129. </td>
  130. </tr>
  131. <tr class="rowColor">
  132. <td class="colFirst"><code>static long</code></td>
  133. <td class="colLast"><code><strong><a href="../../../../../org/apache/commons/compress/utils/IOUtils.html#copy(java.io.InputStream,%20java.io.OutputStream)">copy</a></strong>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;input,
  134. <a href="http://docs.oracle.com/javase/7/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</a>&nbsp;output)</code>
  135. <div class="block">Copies the content of a InputStream into an OutputStream.</div>
  136. </td>
  137. </tr>
  138. <tr class="altColor">
  139. <td class="colFirst"><code>static long</code></td>
  140. <td class="colLast"><code><strong><a href="../../../../../org/apache/commons/compress/utils/IOUtils.html#copy(java.io.InputStream,%20java.io.OutputStream,%20int)">copy</a></strong>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;input,
  141. <a href="http://docs.oracle.com/javase/7/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</a>&nbsp;output,
  142. int&nbsp;buffersize)</code>
  143. <div class="block">Copies the content of a InputStream into an OutputStream</div>
  144. </td>
  145. </tr>
  146. <tr class="rowColor">
  147. <td class="colFirst"><code>static int</code></td>
  148. <td class="colLast"><code><strong><a href="../../../../../org/apache/commons/compress/utils/IOUtils.html#readFully(java.io.InputStream,%20byte[])">readFully</a></strong>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;input,
  149. byte[]&nbsp;b)</code>
  150. <div class="block">Reads as much from input as possible to fill the given array.</div>
  151. </td>
  152. </tr>
  153. <tr class="altColor">
  154. <td class="colFirst"><code>static int</code></td>
  155. <td class="colLast"><code><strong><a href="../../../../../org/apache/commons/compress/utils/IOUtils.html#readFully(java.io.InputStream,%20byte[],%20int,%20int)">readFully</a></strong>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;input,
  156. byte[]&nbsp;b,
  157. int&nbsp;offset,
  158. int&nbsp;len)</code>
  159. <div class="block">Reads as much from input as possible to fill the given array
  160. with the given amount of bytes.</div>
  161. </td>
  162. </tr>
  163. <tr class="rowColor">
  164. <td class="colFirst"><code>static void</code></td>
  165. <td class="colLast"><code><strong><a href="../../../../../org/apache/commons/compress/utils/IOUtils.html#readFully(java.nio.channels.ReadableByteChannel,%20java.nio.ByteBuffer)">readFully</a></strong>(<a href="http://docs.oracle.com/javase/7/docs/api/java/nio/channels/ReadableByteChannel.html?is-external=true" title="class or interface in java.nio.channels">ReadableByteChannel</a>&nbsp;channel,
  166. <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a>&nbsp;b)</code>
  167. <div class="block">Reads <code>b.remaining()</code> bytes from the given channel
  168. starting at the current channel's position.</div>
  169. </td>
  170. </tr>
  171. <tr class="altColor">
  172. <td class="colFirst"><code>static long</code></td>
  173. <td class="colLast"><code><strong><a href="../../../../../org/apache/commons/compress/utils/IOUtils.html#skip(java.io.InputStream,%20long)">skip</a></strong>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;input,
  174. long&nbsp;numToSkip)</code>
  175. <div class="block">Skips the given number of bytes by repeatedly invoking skip on
  176. the given input stream if necessary.</div>
  177. </td>
  178. </tr>
  179. <tr class="rowColor">
  180. <td class="colFirst"><code>static byte[]</code></td>
  181. <td class="colLast"><code><strong><a href="../../../../../org/apache/commons/compress/utils/IOUtils.html#toByteArray(java.io.InputStream)">toByteArray</a></strong>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;input)</code>
  182. <div class="block">Gets the contents of an <code>InputStream</code> as a <code>byte[]</code>.</div>
  183. </td>
  184. </tr>
  185. </table>
  186. <ul class="blockList">
  187. <li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
  188. <!-- -->
  189. </a>
  190. <h3>Methods inherited from class&nbsp;java.lang.<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
  191. <code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait(long,%20int)" title="class or interface in java.lang">wait</a></code></li>
  192. </ul>
  193. </li>
  194. </ul>
  195. </li>
  196. </ul>
  197. </div>
  198. <div class="details">
  199. <ul class="blockList">
  200. <li class="blockList">
  201. <!-- ============ METHOD DETAIL ========== -->
  202. <ul class="blockList">
  203. <li class="blockList"><a name="method_detail">
  204. <!-- -->
  205. </a>
  206. <h3>Method Detail</h3>
  207. <a name="copy(java.io.InputStream, java.io.OutputStream)">
  208. <!-- -->
  209. </a>
  210. <ul class="blockList">
  211. <li class="blockList">
  212. <h4>copy</h4>
  213. <pre>public static&nbsp;long&nbsp;<a href="../../../../../src-html/org/apache/commons/compress/utils/IOUtils.html#line.59">copy</a>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;input,
  214. <a href="http://docs.oracle.com/javase/7/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</a>&nbsp;output)
  215. throws <a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
  216. <div class="block">Copies the content of a InputStream into an OutputStream.
  217. Uses a default buffer size of 8024 bytes.</div>
  218. <dl><dt><span class="strong">Parameters:</span></dt><dd><code>input</code> - the InputStream to copy</dd><dd><code>output</code> - the target Stream</dd>
  219. <dt><span class="strong">Returns:</span></dt><dd>the number of bytes copied</dd>
  220. <dt><span class="strong">Throws:</span></dt>
  221. <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - if an error occurs</dd></dl>
  222. </li>
  223. </ul>
  224. <a name="copy(java.io.InputStream, java.io.OutputStream, int)">
  225. <!-- -->
  226. </a>
  227. <ul class="blockList">
  228. <li class="blockList">
  229. <h4>copy</h4>
  230. <pre>public static&nbsp;long&nbsp;<a href="../../../../../src-html/org/apache/commons/compress/utils/IOUtils.html#line.76">copy</a>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;input,
  231. <a href="http://docs.oracle.com/javase/7/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</a>&nbsp;output,
  232. int&nbsp;buffersize)
  233. throws <a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
  234. <div class="block">Copies the content of a InputStream into an OutputStream</div>
  235. <dl><dt><span class="strong">Parameters:</span></dt><dd><code>input</code> - the InputStream to copy</dd><dd><code>output</code> - the target Stream</dd><dd><code>buffersize</code> - the buffer size to use</dd>
  236. <dt><span class="strong">Returns:</span></dt><dd>the number of bytes copied</dd>
  237. <dt><span class="strong">Throws:</span></dt>
  238. <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - if an error occurs</dd></dl>
  239. </li>
  240. </ul>
  241. <a name="skip(java.io.InputStream, long)">
  242. <!-- -->
  243. </a>
  244. <ul class="blockList">
  245. <li class="blockList">
  246. <h4>skip</h4>
  247. <pre>public static&nbsp;long&nbsp;<a href="../../../../../src-html/org/apache/commons/compress/utils/IOUtils.html#line.103">skip</a>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;input,
  248. long&nbsp;numToSkip)
  249. throws <a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
  250. <div class="block">Skips the given number of bytes by repeatedly invoking skip on
  251. the given input stream if necessary.
  252. <p>In a case where the stream's skip() method returns 0 before
  253. the requested number of bytes has been skip this implementation
  254. will fall back to using the read() method.</p>
  255. <p>This method will only skip less than the requested number of
  256. bytes if the end of the input stream has been reached.</p></div>
  257. <dl><dt><span class="strong">Parameters:</span></dt><dd><code>input</code> - stream to skip bytes in</dd><dd><code>numToSkip</code> - the number of bytes to skip</dd>
  258. <dt><span class="strong">Returns:</span></dt><dd>the number of bytes actually skipped</dd>
  259. <dt><span class="strong">Throws:</span></dt>
  260. <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - on error</dd></dl>
  261. </li>
  262. </ul>
  263. <a name="readFully(java.io.InputStream, byte[])">
  264. <!-- -->
  265. </a>
  266. <ul class="blockList">
  267. <li class="blockList">
  268. <h4>readFully</h4>
  269. <pre>public static&nbsp;int&nbsp;<a href="../../../../../src-html/org/apache/commons/compress/utils/IOUtils.html#line.136">readFully</a>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;input,
  270. byte[]&nbsp;b)
  271. throws <a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
  272. <div class="block">Reads as much from input as possible to fill the given array.
  273. <p>This method may invoke read repeatedly to fill the array and
  274. only read less bytes than the length of the array if the end of
  275. the stream has been reached.</p></div>
  276. <dl><dt><span class="strong">Parameters:</span></dt><dd><code>input</code> - stream to read from</dd><dd><code>b</code> - buffer to fill</dd>
  277. <dt><span class="strong">Returns:</span></dt><dd>the number of bytes actually read</dd>
  278. <dt><span class="strong">Throws:</span></dt>
  279. <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - on error</dd></dl>
  280. </li>
  281. </ul>
  282. <a name="readFully(java.io.InputStream, byte[], int, int)">
  283. <!-- -->
  284. </a>
  285. <ul class="blockList">
  286. <li class="blockList">
  287. <h4>readFully</h4>
  288. <pre>public static&nbsp;int&nbsp;<a href="../../../../../src-html/org/apache/commons/compress/utils/IOUtils.html#line.156">readFully</a>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;input,
  289. byte[]&nbsp;b,
  290. int&nbsp;offset,
  291. int&nbsp;len)
  292. throws <a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
  293. <div class="block">Reads as much from input as possible to fill the given array
  294. with the given amount of bytes.
  295. <p>This method may invoke read repeatedly to read the bytes and
  296. only read less bytes than the requested length if the end of
  297. the stream has been reached.</p></div>
  298. <dl><dt><span class="strong">Parameters:</span></dt><dd><code>input</code> - stream to read from</dd><dd><code>b</code> - buffer to fill</dd><dd><code>offset</code> - offset into the buffer to start filling at</dd><dd><code>len</code> - of bytes to read</dd>
  299. <dt><span class="strong">Returns:</span></dt><dd>the number of bytes actually read</dd>
  300. <dt><span class="strong">Throws:</span></dt>
  301. <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - if an I/O error has occurred</dd></dl>
  302. </li>
  303. </ul>
  304. <a name="readFully(java.nio.channels.ReadableByteChannel, java.nio.ByteBuffer)">
  305. <!-- -->
  306. </a>
  307. <ul class="blockList">
  308. <li class="blockList">
  309. <h4>readFully</h4>
  310. <pre>public static&nbsp;void&nbsp;<a href="../../../../../src-html/org/apache/commons/compress/utils/IOUtils.html#line.186">readFully</a>(<a href="http://docs.oracle.com/javase/7/docs/api/java/nio/channels/ReadableByteChannel.html?is-external=true" title="class or interface in java.nio.channels">ReadableByteChannel</a>&nbsp;channel,
  311. <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a>&nbsp;b)
  312. throws <a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
  313. <div class="block">Reads <code>b.remaining()</code> bytes from the given channel
  314. starting at the current channel's position.
  315. <p>This method reads repeatedly from the channel until the
  316. requested number of bytes are read. This method blocks until
  317. the requested number of bytes are read, the end of the channel
  318. is detected, or an exception is thrown.</p></div>
  319. <dl><dt><span class="strong">Parameters:</span></dt><dd><code>channel</code> - the channel to read from</dd><dd><code>b</code> - the buffer into which the data is read.</dd>
  320. <dt><span class="strong">Throws:</span></dt>
  321. <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - - if an I/O error occurs.</dd>
  322. <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/EOFException.html?is-external=true" title="class or interface in java.io">EOFException</a></code> - - if the channel reaches the end before reading all the bytes.</dd></dl>
  323. </li>
  324. </ul>
  325. <a name="toByteArray(java.io.InputStream)">
  326. <!-- -->
  327. </a>
  328. <ul class="blockList">
  329. <li class="blockList">
  330. <h4>toByteArray</h4>
  331. <pre>public static&nbsp;byte[]&nbsp;<a href="../../../../../src-html/org/apache/commons/compress/utils/IOUtils.html#line.219">toByteArray</a>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;input)
  332. throws <a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
  333. <div class="block">Gets the contents of an <code>InputStream</code> as a <code>byte[]</code>.
  334. <p>
  335. This method buffers the input internally, so there is no need to use a
  336. <code>BufferedInputStream</code>.</div>
  337. <dl><dt><span class="strong">Parameters:</span></dt><dd><code>input</code> - the <code>InputStream</code> to read from</dd>
  338. <dt><span class="strong">Returns:</span></dt><dd>the requested byte array</dd>
  339. <dt><span class="strong">Throws:</span></dt>
  340. <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - if the input is null</dd>
  341. <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - if an I/O error occurs</dd><dt><span class="strong">Since:</span></dt>
  342. <dd>1.5</dd></dl>
  343. </li>
  344. </ul>
  345. <a name="closeQuietly(java.io.Closeable)">
  346. <!-- -->
  347. </a>
  348. <ul class="blockListLast">
  349. <li class="blockList">
  350. <h4>closeQuietly</h4>
  351. <pre>public static&nbsp;void&nbsp;<a href="../../../../../src-html/org/apache/commons/compress/utils/IOUtils.html#line.230">closeQuietly</a>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io">Closeable</a>&nbsp;c)</pre>
  352. <div class="block">Closes the given Closeable and swallows any IOException that may occur.</div>
  353. <dl><dt><span class="strong">Parameters:</span></dt><dd><code>c</code> - Closeable to close, can be null</dd><dt><span class="strong">Since:</span></dt>
  354. <dd>1.7</dd></dl>
  355. </li>
  356. </ul>
  357. </li>
  358. </ul>
  359. </li>
  360. </ul>
  361. </div>
  362. </div>
  363. <!-- ========= END OF CLASS DATA ========= -->
  364. <!-- ======= START OF BOTTOM NAVBAR ====== -->
  365. <div class="bottomNav"><a name="navbar_bottom">
  366. <!-- -->
  367. </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
  368. <!-- -->
  369. </a>
  370. <ul class="navList" title="Navigation">
  371. <li><a href="../../../../../overview-summary.html">Overview</a></li>
  372. <li><a href="package-summary.html">Package</a></li>
  373. <li class="navBarCell1Rev">Class</li>
  374. <li><a href="class-use/IOUtils.html">Use</a></li>
  375. <li><a href="package-tree.html">Tree</a></li>
  376. <li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
  377. <li><a href="../../../../../index-all.html">Index</a></li>
  378. <li><a href="../../../../../help-doc.html">Help</a></li>
  379. </ul>
  380. </div>
  381. <div class="subNav">
  382. <ul class="navList">
  383. <li><a href="../../../../../org/apache/commons/compress/utils/FlushShieldFilterOutputStream.html" title="class in org.apache.commons.compress.utils"><span class="strong">Prev Class</span></a></li>
  384. <li><a href="../../../../../org/apache/commons/compress/utils/Iterators.html" title="class in org.apache.commons.compress.utils"><span class="strong">Next Class</span></a></li>
  385. </ul>
  386. <ul class="navList">
  387. <li><a href="../../../../../index.html?org/apache/commons/compress/utils/IOUtils.html" target="_top">Frames</a></li>
  388. <li><a href="IOUtils.html" target="_top">No Frames</a></li>
  389. </ul>
  390. <ul class="navList" id="allclasses_navbar_bottom">
  391. <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
  392. </ul>
  393. <div>
  394. <script type="text/javascript"><!--
  395. allClassesLink = document.getElementById("allclasses_navbar_bottom");
  396. if(window==top) {
  397. allClassesLink.style.display = "block";
  398. }
  399. else {
  400. allClassesLink.style.display = "none";
  401. }
  402. //-->
  403. </script>
  404. </div>
  405. <div>
  406. <ul class="subNavList">
  407. <li>Summary:&nbsp;</li>
  408. <li>Nested&nbsp;|&nbsp;</li>
  409. <li>Field&nbsp;|&nbsp;</li>
  410. <li>Constr&nbsp;|&nbsp;</li>
  411. <li><a href="#method_summary">Method</a></li>
  412. </ul>
  413. <ul class="subNavList">
  414. <li>Detail:&nbsp;</li>
  415. <li>Field&nbsp;|&nbsp;</li>
  416. <li>Constr&nbsp;|&nbsp;</li>
  417. <li><a href="#method_detail">Method</a></li>
  418. </ul>
  419. </div>
  420. <a name="skip-navbar_bottom">
  421. <!-- -->
  422. </a></div>
  423. <!-- ======== END OF BOTTOM NAVBAR ======= -->
  424. <p class="legalCopy"><small>Copyright &#169; 2016 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
  425. </body>
  426. </html>