| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (1.8.0_292) on Tue Jun 15 06:00:49 GMT 2021 --> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <title>IOUtils (Apache Hadoop Main 3.3.1 API)</title> |
| <meta name="date" content="2021-06-15"> |
| <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> |
| <script type="text/javascript" src="../../../../script.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="IOUtils (Apache Hadoop Main 3.3.1 API)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var methods = {"i0":41,"i1":9,"i2":9,"i3":9,"i4":9,"i5":9,"i6":9,"i7":9,"i8":9,"i9":9,"i10":9,"i11":9,"i12":9,"i13":9,"i14":9,"i15":9,"i16":9,"i17":9,"i18":9,"i19":9}; |
| var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"],32:["t6","Deprecated Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/IOUtils.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../org/apache/hadoop/io/LongWritable.html" title="class in org.apache.hadoop.io"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../index.html?org/apache/hadoop/io/IOUtils.html" target="_top">Frames</a></li> |
| <li><a href="IOUtils.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle">org.apache.hadoop.io</div> |
| <h2 title="Class IOUtils" class="title">Class IOUtils</h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li>org.apache.hadoop.io.IOUtils</li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <hr> |
| <br> |
| <pre>@InterfaceAudience.Public |
| @InterfaceStability.Evolving |
| public class <span class="typeNameLabel">IOUtils</span> |
| extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre> |
| <div class="block">An utility class for I/O related functionality.</div> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- =========== FIELD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="field.summary"> |
| <!-- --> |
| </a> |
| <h3>Field Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation"> |
| <caption><span>Fields</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Field and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static org.slf4j.Logger</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/IOUtils.html#LOG">LOG</a></span></code> </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.summary"> |
| <!-- --> |
| </a> |
| <h3>Constructor Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> |
| <caption><span>Constructors</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colOne" scope="col">Constructor and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colOne"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/IOUtils.html#IOUtils--">IOUtils</a></span>()</code> </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span><span id="t6" class="tableTab"><span><a href="javascript:show(32);">Deprecated Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Method and Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/IOUtils.html#cleanup-org.apache.commons.logging.Log-java.io.Closeable...-">cleanup</a></span>(org.apache.commons.logging.Log log, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io">Closeable</a>... closeables)</code> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> |
| <div class="block"><span class="deprecationComment">use <a href="../../../../org/apache/hadoop/io/IOUtils.html#cleanupWithLogger-org.slf4j.Logger-java.io.Closeable...-"><code>cleanupWithLogger(Logger, java.io.Closeable...)</code></a> |
| instead</span></div> |
| </div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/IOUtils.html#cleanupWithLogger-org.slf4j.Logger-java.io.Closeable...-">cleanupWithLogger</a></span>(org.slf4j.Logger logger, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io">Closeable</a>... closeables)</code> |
| <div class="block">Close the Closeable objects and <b>ignore</b> any <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang"><code>Throwable</code></a> or |
| null pointers.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/IOUtils.html#closeSocket-java.net.Socket-">closeSocket</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/net/Socket.html?is-external=true" title="class or interface in java.net">Socket</a> sock)</code> |
| <div class="block">Closes the socket ignoring <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io"><code>IOException</code></a></div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/IOUtils.html#closeStream-java.io.Closeable-">closeStream</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io">Closeable</a> stream)</code> |
| <div class="block">Closes the stream ignoring <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang"><code>Throwable</code></a>.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/IOUtils.html#closeStreams-java.io.Closeable...-">closeStreams</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io">Closeable</a>... streams)</code> |
| <div class="block">Closes the streams ignoring <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang"><code>Throwable</code></a>.</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/IOUtils.html#copyBytes-java.io.InputStream-java.io.OutputStream-org.apache.hadoop.conf.Configuration-">copyBytes</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a> in, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</a> out, |
| <a href="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</a> conf)</code> |
| <div class="block">Copies from one stream to another.</div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/IOUtils.html#copyBytes-java.io.InputStream-java.io.OutputStream-org.apache.hadoop.conf.Configuration-boolean-">copyBytes</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a> in, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</a> out, |
| <a href="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</a> conf, |
| boolean close)</code> |
| <div class="block">Copies from one stream to another.</div> |
| </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/IOUtils.html#copyBytes-java.io.InputStream-java.io.OutputStream-int-">copyBytes</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a> in, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</a> out, |
| int buffSize)</code> |
| <div class="block">Copies from one stream to another.</div> |
| </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/IOUtils.html#copyBytes-java.io.InputStream-java.io.OutputStream-int-boolean-">copyBytes</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a> in, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</a> out, |
| int buffSize, |
| boolean close)</code> |
| <div class="block">Copies from one stream to another.</div> |
| </td> |
| </tr> |
| <tr id="i9" class="rowColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/IOUtils.html#copyBytes-java.io.InputStream-java.io.OutputStream-long-boolean-">copyBytes</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a> in, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</a> out, |
| long count, |
| boolean close)</code> |
| <div class="block">Copies count bytes from one stream to another.</div> |
| </td> |
| </tr> |
| <tr id="i10" class="altColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/IOUtils.html#fsync-java.io.File-">fsync</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> fileToSync)</code> |
| <div class="block">Ensure that any writes to the given file is written to the storage device |
| that contains it.</div> |
| </td> |
| </tr> |
| <tr id="i11" class="rowColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/IOUtils.html#fsync-java.nio.channels.FileChannel-boolean-">fsync</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/channels/FileChannel.html?is-external=true" title="class or interface in java.nio.channels">FileChannel</a> channel, |
| boolean isDir)</code> |
| <div class="block">Ensure that any writes to the given file is written to the storage device |
| that contains it.</div> |
| </td> |
| </tr> |
| <tr id="i12" class="altColor"> |
| <td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/IOUtils.html#listDirectory-java.io.File-java.io.FilenameFilter-">listDirectory</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> dir, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/FilenameFilter.html?is-external=true" title="class or interface in java.io">FilenameFilter</a> filter)</code> |
| <div class="block">Return the complete list of files in a directory as strings.</div> |
| </td> |
| </tr> |
| <tr id="i13" class="rowColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/IOUtils.html#readFully-java.io.InputStream-byte:A-int-int-">readFully</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a> in, |
| byte[] buf, |
| int off, |
| int len)</code> |
| <div class="block">Reads len bytes in a loop.</div> |
| </td> |
| </tr> |
| <tr id="i14" class="altColor"> |
| <td class="colFirst"><code>static byte[]</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/IOUtils.html#readFullyToByteArray-java.io.DataInput-">readFullyToByteArray</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/DataInput.html?is-external=true" title="class or interface in java.io">DataInput</a> in)</code> |
| <div class="block">Reads a DataInput until EOF and returns a byte array.</div> |
| </td> |
| </tr> |
| <tr id="i15" class="rowColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/IOUtils.html#skipFully-java.io.InputStream-long-">skipFully</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a> in, |
| long len)</code> |
| <div class="block">Similar to readFully().</div> |
| </td> |
| </tr> |
| <tr id="i16" class="altColor"> |
| <td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/IOUtils.html#wrapException-java.lang.String-java.lang.String-java.io.IOException-">wrapException</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> path, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> methodName, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a> exception)</code> |
| <div class="block">Takes an IOException, file/directory path, and method name and returns an |
| IOException with the input exception as the cause and also include the |
| file,method details.</div> |
| </td> |
| </tr> |
| <tr id="i17" class="rowColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/IOUtils.html#wrappedReadForCompressedData-java.io.InputStream-byte:A-int-int-">wrappedReadForCompressedData</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a> is, |
| byte[] buf, |
| int off, |
| int len)</code> |
| <div class="block">Utility wrapper for reading from <a href="https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io"><code>InputStream</code></a>.</div> |
| </td> |
| </tr> |
| <tr id="i18" class="altColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/IOUtils.html#writeFully-java.nio.channels.FileChannel-java.nio.ByteBuffer-long-">writeFully</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/channels/FileChannel.html?is-external=true" title="class or interface in java.nio.channels">FileChannel</a> fc, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a> buf, |
| long offset)</code> |
| <div class="block">Write a ByteBuffer to a FileChannel at a given offset, |
| handling short writes.</div> |
| </td> |
| </tr> |
| <tr id="i19" class="rowColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/IOUtils.html#writeFully-java.nio.channels.WritableByteChannel-java.nio.ByteBuffer-">writeFully</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/channels/WritableByteChannel.html?is-external=true" title="class or interface in java.nio.channels">WritableByteChannel</a> bc, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a> buf)</code> |
| <div class="block">Write a ByteBuffer to a WritableByteChannel, handling short writes.</div> |
| </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3> |
| <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ FIELD DETAIL =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="field.detail"> |
| <!-- --> |
| </a> |
| <h3>Field Detail</h3> |
| <a name="LOG"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>LOG</h4> |
| <pre>public static final org.slf4j.Logger LOG</pre> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.detail"> |
| <!-- --> |
| </a> |
| <h3>Constructor Detail</h3> |
| <a name="IOUtils--"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>IOUtils</h4> |
| <pre>public IOUtils()</pre> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a name="copyBytes-java.io.InputStream-java.io.OutputStream-int-boolean-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>copyBytes</h4> |
| <pre>public static void copyBytes(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a> in, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</a> out, |
| int buffSize, |
| boolean close) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre> |
| <div class="block">Copies from one stream to another.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>in</code> - InputStrem to read from</dd> |
| <dd><code>out</code> - OutputStream to write to</dd> |
| <dd><code>buffSize</code> - the size of the buffer</dd> |
| <dd><code>close</code> - whether or not close the InputStream and |
| OutputStream at the end. The streams are closed in the finally clause.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="copyBytes-java.io.InputStream-java.io.OutputStream-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>copyBytes</h4> |
| <pre>public static void copyBytes(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a> in, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</a> out, |
| int buffSize) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre> |
| <div class="block">Copies from one stream to another.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>in</code> - InputStrem to read from</dd> |
| <dd><code>out</code> - OutputStream to write to</dd> |
| <dd><code>buffSize</code> - the size of the buffer</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="copyBytes-java.io.InputStream-java.io.OutputStream-org.apache.hadoop.conf.Configuration-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>copyBytes</h4> |
| <pre>public static void copyBytes(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a> in, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</a> out, |
| <a href="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</a> conf) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre> |
| <div class="block">Copies from one stream to another. <strong>closes the input and output streams |
| at the end</strong>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>in</code> - InputStrem to read from</dd> |
| <dd><code>out</code> - OutputStream to write to</dd> |
| <dd><code>conf</code> - the Configuration object</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="copyBytes-java.io.InputStream-java.io.OutputStream-org.apache.hadoop.conf.Configuration-boolean-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>copyBytes</h4> |
| <pre>public static void copyBytes(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a> in, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</a> out, |
| <a href="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</a> conf, |
| boolean close) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre> |
| <div class="block">Copies from one stream to another.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>in</code> - InputStream to read from</dd> |
| <dd><code>out</code> - OutputStream to write to</dd> |
| <dd><code>conf</code> - the Configuration object</dd> |
| <dd><code>close</code> - whether or not close the InputStream and |
| OutputStream at the end. The streams are closed in the finally clause.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="copyBytes-java.io.InputStream-java.io.OutputStream-long-boolean-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>copyBytes</h4> |
| <pre>public static void copyBytes(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a> in, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</a> out, |
| long count, |
| boolean close) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre> |
| <div class="block">Copies count bytes from one stream to another.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>in</code> - InputStream to read from</dd> |
| <dd><code>out</code> - OutputStream to write to</dd> |
| <dd><code>count</code> - number of bytes to copy</dd> |
| <dd><code>close</code> - whether to close the streams</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - if bytes can not be read or written</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="wrappedReadForCompressedData-java.io.InputStream-byte:A-int-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>wrappedReadForCompressedData</h4> |
| <pre>public static int wrappedReadForCompressedData(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a> is, |
| byte[] buf, |
| int off, |
| int len) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre> |
| <div class="block">Utility wrapper for reading from <a href="https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io"><code>InputStream</code></a>. It catches any errors |
| thrown by the underlying stream (either IO or decompression-related), and |
| re-throws as an IOException.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>is</code> - - InputStream to be read from</dd> |
| <dd><code>buf</code> - - buffer the data is read into</dd> |
| <dd><code>off</code> - - offset within buf</dd> |
| <dd><code>len</code> - - amount of data to be read</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>number of bytes read</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="readFully-java.io.InputStream-byte:A-int-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>readFully</h4> |
| <pre>public static void readFully(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a> in, |
| byte[] buf, |
| int off, |
| int len) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre> |
| <div class="block">Reads len bytes in a loop.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>in</code> - InputStream to read from</dd> |
| <dd><code>buf</code> - The buffer to fill</dd> |
| <dd><code>off</code> - offset from the buffer</dd> |
| <dd><code>len</code> - the length of bytes to read</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - if it could not read requested number of bytes |
| for any reason (including EOF)</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="skipFully-java.io.InputStream-long-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>skipFully</h4> |
| <pre>public static void skipFully(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a> in, |
| long len) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre> |
| <div class="block">Similar to readFully(). Skips bytes in a loop.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>in</code> - The InputStream to skip bytes from</dd> |
| <dd><code>len</code> - number of bytes to skip.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - if it could not skip requested number of bytes |
| for any reason (including EOF)</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="cleanup-org.apache.commons.logging.Log-java.io.Closeable...-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>cleanup</h4> |
| <pre><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a> |
| public static void cleanup(org.apache.commons.logging.Log log, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io">Closeable</a>... closeables)</pre> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">use <a href="../../../../org/apache/hadoop/io/IOUtils.html#cleanupWithLogger-org.slf4j.Logger-java.io.Closeable...-"><code>cleanupWithLogger(Logger, java.io.Closeable...)</code></a> |
| instead</span></div> |
| <div class="block">Close the Closeable objects and <b>ignore</b> any <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang"><code>Throwable</code></a> or |
| null pointers. Must only be used for cleanup in exception handlers.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>log</code> - the log to record problems to at debug level. Can be null.</dd> |
| <dd><code>closeables</code> - the objects to close</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="cleanupWithLogger-org.slf4j.Logger-java.io.Closeable...-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>cleanupWithLogger</h4> |
| <pre>public static void cleanupWithLogger(org.slf4j.Logger logger, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io">Closeable</a>... closeables)</pre> |
| <div class="block">Close the Closeable objects and <b>ignore</b> any <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang"><code>Throwable</code></a> or |
| null pointers. Must only be used for cleanup in exception handlers.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>logger</code> - the log to record problems to at debug level. Can be null.</dd> |
| <dd><code>closeables</code> - the objects to close</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="closeStream-java.io.Closeable-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>closeStream</h4> |
| <pre>public static void closeStream(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io">Closeable</a> stream)</pre> |
| <div class="block">Closes the stream ignoring <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang"><code>Throwable</code></a>. |
| Must only be called in cleaning up from exception handlers.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>stream</code> - the Stream to close</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="closeStreams-java.io.Closeable...-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>closeStreams</h4> |
| <pre>public static void closeStreams(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io">Closeable</a>... streams)</pre> |
| <div class="block">Closes the streams ignoring <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang"><code>Throwable</code></a>. |
| Must only be called in cleaning up from exception handlers.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>streams</code> - the Streams to close</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="closeSocket-java.net.Socket-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>closeSocket</h4> |
| <pre>public static void closeSocket(<a href="https://docs.oracle.com/javase/8/docs/api/java/net/Socket.html?is-external=true" title="class or interface in java.net">Socket</a> sock)</pre> |
| <div class="block">Closes the socket ignoring <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io"><code>IOException</code></a></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>sock</code> - the Socket to close</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="writeFully-java.nio.channels.WritableByteChannel-java.nio.ByteBuffer-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>writeFully</h4> |
| <pre>public static void writeFully(<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/channels/WritableByteChannel.html?is-external=true" title="class or interface in java.nio.channels">WritableByteChannel</a> bc, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a> buf) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre> |
| <div class="block">Write a ByteBuffer to a WritableByteChannel, handling short writes.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>bc</code> - The WritableByteChannel to write to</dd> |
| <dd><code>buf</code> - The input buffer</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - On I/O error</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="writeFully-java.nio.channels.FileChannel-java.nio.ByteBuffer-long-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>writeFully</h4> |
| <pre>public static void writeFully(<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/channels/FileChannel.html?is-external=true" title="class or interface in java.nio.channels">FileChannel</a> fc, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a> buf, |
| long offset) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre> |
| <div class="block">Write a ByteBuffer to a FileChannel at a given offset, |
| handling short writes.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>fc</code> - The FileChannel to write to</dd> |
| <dd><code>buf</code> - The input buffer</dd> |
| <dd><code>offset</code> - The offset in the file to start writing at</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - On I/O error</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="listDirectory-java.io.File-java.io.FilenameFilter-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>listDirectory</h4> |
| <pre>public static <a href="https://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>> listDirectory(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> dir, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/FilenameFilter.html?is-external=true" title="class or interface in java.io">FilenameFilter</a> filter) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre> |
| <div class="block">Return the complete list of files in a directory as strings.<p> |
| |
| This is better than File#listDir because it does not ignore IOExceptions.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>dir</code> - The directory to list.</dd> |
| <dd><code>filter</code> - If non-null, the filter to use when listing |
| this directory.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>The list of files in the directory.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - On I/O error</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="fsync-java.io.File-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>fsync</h4> |
| <pre>public static void fsync(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> fileToSync) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre> |
| <div class="block">Ensure that any writes to the given file is written to the storage device |
| that contains it. This method opens channel on given File and closes it |
| once the sync is done.<br> |
| Borrowed from Uwe Schindler in LUCENE-5588</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>fileToSync</code> - the file to fsync</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="fsync-java.nio.channels.FileChannel-boolean-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>fsync</h4> |
| <pre>public static void fsync(<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/channels/FileChannel.html?is-external=true" title="class or interface in java.nio.channels">FileChannel</a> channel, |
| boolean isDir) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre> |
| <div class="block">Ensure that any writes to the given file is written to the storage device |
| that contains it. This method opens channel on given File and closes it |
| once the sync is done. |
| Borrowed from Uwe Schindler in LUCENE-5588</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>channel</code> - Channel to sync</dd> |
| <dd><code>isDir</code> - if true, the given file is a directory (Channel should be |
| opened for read and ignore IOExceptions, because not all file |
| systems and operating systems allow to fsync on a directory)</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="wrapException-java.lang.String-java.lang.String-java.io.IOException-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>wrapException</h4> |
| <pre>public static <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a> wrapException(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> path, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> methodName, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a> exception)</pre> |
| <div class="block">Takes an IOException, file/directory path, and method name and returns an |
| IOException with the input exception as the cause and also include the |
| file,method details. The new exception provides the stack trace of the |
| place where the exception is thrown and some extra diagnostics |
| information. |
| |
| Return instance of same exception if exception class has a public string |
| constructor; Otherwise return an PathIOException. |
| InterruptedIOException and PathIOException are returned unwrapped.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>path</code> - file/directory path</dd> |
| <dd><code>methodName</code> - method name</dd> |
| <dd><code>exception</code> - the caught exception.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>an exception to throw</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="readFullyToByteArray-java.io.DataInput-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>readFullyToByteArray</h4> |
| <pre>public static byte[] readFullyToByteArray(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/DataInput.html?is-external=true" title="class or interface in java.io">DataInput</a> in) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre> |
| <div class="block">Reads a DataInput until EOF and returns a byte array. Make sure not to |
| pass in an infinite DataInput or this will never return.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>in</code> - A DataInput</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a byte array containing the data from the DataInput</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - on I/O error, other than EOF</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/IOUtils.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../org/apache/hadoop/io/LongWritable.html" title="class in org.apache.hadoop.io"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../index.html?org/apache/hadoop/io/IOUtils.html" target="_top">Frames</a></li> |
| <li><a href="IOUtils.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| <p class="legalCopy"><small>Copyright © 2021 <a href="https://www.apache.org">Apache Software Foundation</a>. All rights reserved.</small></p> |
| </body> |
| </html> |