<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="de"> <head> <!-- Generated by javadoc --> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>FileUtils (Apache Commons IO 2.6 API)</title> <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="FileUtils (Apache Commons IO 2.6 API)"; } } catch(err) { } //--> var methods = {"i0":9,"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,"i20":9,"i21":9,"i22":9,"i23":9,"i24":9,"i25":9,"i26":9,"i27":9,"i28":9,"i29":9,"i30":9,"i31":9,"i32":9,"i33":9,"i34":9,"i35":9,"i36":9,"i37":9,"i38":9,"i39":9,"i40":9,"i41":9,"i42":9,"i43":9,"i44":9,"i45":9,"i46":9,"i47":9,"i48":9,"i49":9,"i50":9,"i51":9,"i52":9,"i53":9,"i54":9,"i55":9,"i56":9,"i57":9,"i58":9,"i59":9,"i60":9,"i61":41,"i62":9,"i63":9,"i64":41,"i65":9,"i66":9,"i67":9,"i68":9,"i69":9,"i70":9,"i71":9,"i72":9,"i73":9,"i74":9,"i75":9,"i76":41,"i77":41,"i78":9,"i79":9,"i80":9,"i81":9,"i82":9,"i83":9,"i84":9,"i85":9,"i86":9,"i87":9,"i88":9,"i89":9,"i90":9,"i91":9,"i92":9,"i93":9,"i94":41,"i95":41,"i96":9,"i97":9,"i98":9,"i99":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/FileUtils.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/commons/io/FileSystemUtils.html" title="class in org.apache.commons.io"><span class="typeNameLink">Prev Class</span></a></li> <li><a href="../../../../org/apache/commons/io/HexDump.html" title="class in org.apache.commons.io"><span class="typeNameLink">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/apache/commons/io/FileUtils.html" target="_top">Frames</a></li> <li><a href="FileUtils.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.commons.io</div> <h2 title="Class FileUtils" class="title">Class FileUtils</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <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> <li> <ul class="inheritance"> <li>org.apache.commons.io.FileUtils</li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <hr> <br> <pre>public class <span class="typeNameLabel">FileUtils</span> 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> <div class="block">General file manipulation utilities. <p> Facilities are provided in the following areas: <ul> <li>writing to a file <li>reading from a file <li>make a directory including parent directories <li>copying files and directories <li>deleting files and directories <li>converting to and from a URL <li>listing files and directories by filter and extension <li>comparing file content <li>file last changed date <li>calculating a checksum </ul> <p> Note that a specific charset should be specified whenever possible. Relying on the platform default means that the code is Locale-dependent. Only use the default if the files are known to always use the platform default. <p> Origin of code: Excalibur, Alexandria, Commons-Utils</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 <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>[]</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#EMPTY_FILE_ARRAY">EMPTY_FILE_ARRAY</a></span></code> <div class="block">An empty array of type <code>File</code>.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>static long</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#ONE_EB">ONE_EB</a></span></code> <div class="block">The number of bytes in an exabyte.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#ONE_EB_BI">ONE_EB_BI</a></span></code> <div class="block">The number of bytes in an exabyte.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>static long</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#ONE_GB">ONE_GB</a></span></code> <div class="block">The number of bytes in a gigabyte.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#ONE_GB_BI">ONE_GB_BI</a></span></code> <div class="block">The number of bytes in a gigabyte.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>static long</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#ONE_KB">ONE_KB</a></span></code> <div class="block">The number of bytes in a kilobyte.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#ONE_KB_BI">ONE_KB_BI</a></span></code> <div class="block">The number of bytes in a kilobyte.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>static long</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#ONE_MB">ONE_MB</a></span></code> <div class="block">The number of bytes in a megabyte.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#ONE_MB_BI">ONE_MB_BI</a></span></code> <div class="block">The number of bytes in a megabyte.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>static long</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#ONE_PB">ONE_PB</a></span></code> <div class="block">The number of bytes in a petabyte.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#ONE_PB_BI">ONE_PB_BI</a></span></code> <div class="block">The number of bytes in a petabyte.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>static long</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#ONE_TB">ONE_TB</a></span></code> <div class="block">The number of bytes in a terabyte.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#ONE_TB_BI">ONE_TB_BI</a></span></code> <div class="block">The number of bytes in a terabyte.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#ONE_YB">ONE_YB</a></span></code> <div class="block">The number of bytes in a yottabyte.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#ONE_ZB">ONE_ZB</a></span></code> <div class="block">The number of bytes in a zettabyte.</div> </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/commons/io/FileUtils.html#FileUtils--">FileUtils</a></span>()</code> <div class="block">Instances should NOT be constructed in standard programming.</div> </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 <a href="http://docs.oracle.com/javase/7/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/commons/io/FileUtils.html#byteCountToDisplaySize-java.math.BigInteger-">byteCountToDisplaySize</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a> size)</code> <div class="block">Returns a human-readable version of the file size, where the input represents a specific number of bytes.</div> </td> </tr> <tr id="i1" class="rowColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/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/commons/io/FileUtils.html#byteCountToDisplaySize-long-">byteCountToDisplaySize</a></span>(long size)</code> <div class="block">Returns a human-readable version of the file size, where the input represents a specific number of bytes.</div> </td> </tr> <tr id="i2" class="altColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/util/zip/Checksum.html?is-external=true" title="class or interface in java.util.zip">Checksum</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#checksum-java.io.File-java.util.zip.Checksum-">checksum</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/util/zip/Checksum.html?is-external=true" title="class or interface in java.util.zip">Checksum</a> checksum)</code> <div class="block">Computes the checksum of a file using the specified checksum object.</div> </td> </tr> <tr id="i3" class="rowColor"> <td class="colFirst"><code>static long</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#checksumCRC32-java.io.File-">checksumCRC32</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file)</code> <div class="block">Computes the checksum of a file using the CRC32 checksum routine.</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/commons/io/FileUtils.html#cleanDirectory-java.io.File-">cleanDirectory</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> directory)</code> <div class="block">Cleans a directory without deleting it.</div> </td> </tr> <tr id="i5" class="rowColor"> <td class="colFirst"><code>static boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#contentEquals-java.io.File-java.io.File-">contentEquals</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file1, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file2)</code> <div class="block">Compares the contents of two files to determine if they are equal or not.</div> </td> </tr> <tr id="i6" class="altColor"> <td class="colFirst"><code>static boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#contentEqualsIgnoreEOL-java.io.File-java.io.File-java.lang.String-">contentEqualsIgnoreEOL</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file1, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file2, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> charsetName)</code> <div class="block">Compares the contents of two files to determine if they are equal or not.</div> </td> </tr> <tr id="i7" class="rowColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>[]</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#convertFileCollectionToFileArray-java.util.Collection-">convertFileCollectionToFileArray</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>> files)</code> <div class="block">Converts a Collection containing java.io.File instanced into array representation.</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/commons/io/FileUtils.html#copyDirectory-java.io.File-java.io.File-">copyDirectory</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> srcDir, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destDir)</code> <div class="block">Copies a whole directory to a new location preserving the file dates.</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/commons/io/FileUtils.html#copyDirectory-java.io.File-java.io.File-boolean-">copyDirectory</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> srcDir, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destDir, boolean preserveFileDate)</code> <div class="block">Copies a whole directory to a new location.</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/commons/io/FileUtils.html#copyDirectory-java.io.File-java.io.File-java.io.FileFilter-">copyDirectory</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> srcDir, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destDir, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/FileFilter.html?is-external=true" title="class or interface in java.io">FileFilter</a> filter)</code> <div class="block">Copies a filtered directory to a new location preserving the file dates.</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/commons/io/FileUtils.html#copyDirectory-java.io.File-java.io.File-java.io.FileFilter-boolean-">copyDirectory</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> srcDir, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destDir, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/FileFilter.html?is-external=true" title="class or interface in java.io">FileFilter</a> filter, boolean preserveFileDate)</code> <div class="block">Copies a filtered directory to a new location.</div> </td> </tr> <tr id="i12" class="altColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#copyDirectoryToDirectory-java.io.File-java.io.File-">copyDirectoryToDirectory</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> srcDir, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destDir)</code> <div class="block">Copies a directory to within another directory preserving the file dates.</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/commons/io/FileUtils.html#copyFile-java.io.File-java.io.File-">copyFile</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> srcFile, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destFile)</code> <div class="block">Copies a file to a new location preserving the file date.</div> </td> </tr> <tr id="i14" class="altColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#copyFile-java.io.File-java.io.File-boolean-">copyFile</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> srcFile, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destFile, boolean preserveFileDate)</code> <div class="block">Copies a file to a new location.</div> </td> </tr> <tr id="i15" class="rowColor"> <td class="colFirst"><code>static long</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#copyFile-java.io.File-java.io.OutputStream-">copyFile</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> input, <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> output)</code> <div class="block">Copy bytes from a <code>File</code> to an <code>OutputStream</code>.</div> </td> </tr> <tr id="i16" class="altColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#copyFileToDirectory-java.io.File-java.io.File-">copyFileToDirectory</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> srcFile, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destDir)</code> <div class="block">Copies a file to a directory preserving the file date.</div> </td> </tr> <tr id="i17" class="rowColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#copyFileToDirectory-java.io.File-java.io.File-boolean-">copyFileToDirectory</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> srcFile, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destDir, boolean preserveFileDate)</code> <div class="block">Copies a file to a directory optionally preserving the file date.</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/commons/io/FileUtils.html#copyInputStreamToFile-java.io.InputStream-java.io.File-">copyInputStreamToFile</a></span>(<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> source, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destination)</code> <div class="block">Copies bytes from an <a href="http://docs.oracle.com/javase/7/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io"><code>InputStream</code></a> <code>source</code> to a file <code>destination</code>.</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/commons/io/FileUtils.html#copyToDirectory-java.io.File-java.io.File-">copyToDirectory</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> src, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destDir)</code> <div class="block">Copies a file or directory to within another directory preserving the file dates.</div> </td> </tr> <tr id="i20" class="altColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#copyToDirectory-java.lang.Iterable-java.io.File-">copyToDirectory</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>> srcs, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destDir)</code> <div class="block">Copies a files to a directory preserving each file's date.</div> </td> </tr> <tr id="i21" class="rowColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#copyToFile-java.io.InputStream-java.io.File-">copyToFile</a></span>(<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> source, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destination)</code> <div class="block">Copies bytes from an <a href="http://docs.oracle.com/javase/7/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io"><code>InputStream</code></a> <code>source</code> to a file <code>destination</code>.</div> </td> </tr> <tr id="i22" class="altColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#copyURLToFile-java.net.URL-java.io.File-">copyURLToFile</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</a> source, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destination)</code> <div class="block">Copies bytes from the URL <code>source</code> to a file <code>destination</code>.</div> </td> </tr> <tr id="i23" class="rowColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#copyURLToFile-java.net.URL-java.io.File-int-int-">copyURLToFile</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</a> source, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destination, int connectionTimeout, int readTimeout)</code> <div class="block">Copies bytes from the URL <code>source</code> to a file <code>destination</code>.</div> </td> </tr> <tr id="i24" class="altColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#deleteDirectory-java.io.File-">deleteDirectory</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> directory)</code> <div class="block">Deletes a directory recursively.</div> </td> </tr> <tr id="i25" class="rowColor"> <td class="colFirst"><code>static boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#deleteQuietly-java.io.File-">deleteQuietly</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file)</code> <div class="block">Deletes a file, never throwing an exception.</div> </td> </tr> <tr id="i26" class="altColor"> <td class="colFirst"><code>static boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#directoryContains-java.io.File-java.io.File-">directoryContains</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> directory, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> child)</code> <div class="block">Determines whether the <code>parent</code> directory contains the <code>child</code> element (a file or directory).</div> </td> </tr> <tr id="i27" class="rowColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#forceDelete-java.io.File-">forceDelete</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file)</code> <div class="block">Deletes a file.</div> </td> </tr> <tr id="i28" class="altColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#forceDeleteOnExit-java.io.File-">forceDeleteOnExit</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file)</code> <div class="block">Schedules a file to be deleted when JVM exits.</div> </td> </tr> <tr id="i29" class="rowColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#forceMkdir-java.io.File-">forceMkdir</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> directory)</code> <div class="block">Makes a directory, including any necessary but nonexistent parent directories.</div> </td> </tr> <tr id="i30" class="altColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#forceMkdirParent-java.io.File-">forceMkdirParent</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file)</code> <div class="block">Makes any necessary but nonexistent parent directories for a given File.</div> </td> </tr> <tr id="i31" class="rowColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#getFile-java.io.File-java.lang.String...-">getFile</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> directory, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... names)</code> <div class="block">Construct a file from the set of name elements.</div> </td> </tr> <tr id="i32" class="altColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#getFile-java.lang.String...-">getFile</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... names)</code> <div class="block">Construct a file from the set of name elements.</div> </td> </tr> <tr id="i33" class="rowColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#getTempDirectory--">getTempDirectory</a></span>()</code> <div class="block">Returns a <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io"><code>File</code></a> representing the system temporary directory.</div> </td> </tr> <tr id="i34" class="altColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/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/commons/io/FileUtils.html#getTempDirectoryPath--">getTempDirectoryPath</a></span>()</code> <div class="block">Returns the path to the system temporary directory.</div> </td> </tr> <tr id="i35" class="rowColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#getUserDirectory--">getUserDirectory</a></span>()</code> <div class="block">Returns a <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io"><code>File</code></a> representing the user's home directory.</div> </td> </tr> <tr id="i36" class="altColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/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/commons/io/FileUtils.html#getUserDirectoryPath--">getUserDirectoryPath</a></span>()</code> <div class="block">Returns the path to the user's home directory.</div> </td> </tr> <tr id="i37" class="rowColor"> <td class="colFirst"><code>static boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#isFileNewer-java.io.File-java.util.Date-">isFileNewer</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Date.html?is-external=true" title="class or interface in java.util">Date</a> date)</code> <div class="block">Tests if the specified <code>File</code> is newer than the specified <code>Date</code>.</div> </td> </tr> <tr id="i38" class="altColor"> <td class="colFirst"><code>static boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#isFileNewer-java.io.File-java.io.File-">isFileNewer</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> reference)</code> <div class="block">Tests if the specified <code>File</code> is newer than the reference <code>File</code>.</div> </td> </tr> <tr id="i39" class="rowColor"> <td class="colFirst"><code>static boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#isFileNewer-java.io.File-long-">isFileNewer</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, long timeMillis)</code> <div class="block">Tests if the specified <code>File</code> is newer than the specified time reference.</div> </td> </tr> <tr id="i40" class="altColor"> <td class="colFirst"><code>static boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#isFileOlder-java.io.File-java.util.Date-">isFileOlder</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Date.html?is-external=true" title="class or interface in java.util">Date</a> date)</code> <div class="block">Tests if the specified <code>File</code> is older than the specified <code>Date</code>.</div> </td> </tr> <tr id="i41" class="rowColor"> <td class="colFirst"><code>static boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#isFileOlder-java.io.File-java.io.File-">isFileOlder</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> reference)</code> <div class="block">Tests if the specified <code>File</code> is older than the reference <code>File</code>.</div> </td> </tr> <tr id="i42" class="altColor"> <td class="colFirst"><code>static boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#isFileOlder-java.io.File-long-">isFileOlder</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, long timeMillis)</code> <div class="block">Tests if the specified <code>File</code> is older than the specified time reference.</div> </td> </tr> <tr id="i43" class="rowColor"> <td class="colFirst"><code>static boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#isSymlink-java.io.File-">isSymlink</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file)</code> <div class="block">Determines whether the specified file is a Symbolic Link rather than an actual file.</div> </td> </tr> <tr id="i44" class="altColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#iterateFiles-java.io.File-org.apache.commons.io.filefilter.IOFileFilter-org.apache.commons.io.filefilter.IOFileFilter-">iterateFiles</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> directory, <a href="../../../../org/apache/commons/io/filefilter/IOFileFilter.html" title="interface in org.apache.commons.io.filefilter">IOFileFilter</a> fileFilter, <a href="../../../../org/apache/commons/io/filefilter/IOFileFilter.html" title="interface in org.apache.commons.io.filefilter">IOFileFilter</a> dirFilter)</code> <div class="block">Allows iteration over the files in given directory (and optionally its subdirectories).</div> </td> </tr> <tr id="i45" class="rowColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#iterateFiles-java.io.File-java.lang.String:A-boolean-">iterateFiles</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> directory, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[] extensions, boolean recursive)</code> <div class="block">Allows iteration over the files in a given directory (and optionally its subdirectories) which match an array of extensions.</div> </td> </tr> <tr id="i46" class="altColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#iterateFilesAndDirs-java.io.File-org.apache.commons.io.filefilter.IOFileFilter-org.apache.commons.io.filefilter.IOFileFilter-">iterateFilesAndDirs</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> directory, <a href="../../../../org/apache/commons/io/filefilter/IOFileFilter.html" title="interface in org.apache.commons.io.filefilter">IOFileFilter</a> fileFilter, <a href="../../../../org/apache/commons/io/filefilter/IOFileFilter.html" title="interface in org.apache.commons.io.filefilter">IOFileFilter</a> dirFilter)</code> <div class="block">Allows iteration over the files in given directory (and optionally its subdirectories).</div> </td> </tr> <tr id="i47" class="rowColor"> <td class="colFirst"><code>static <a href="../../../../org/apache/commons/io/LineIterator.html" title="class in org.apache.commons.io">LineIterator</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#lineIterator-java.io.File-">lineIterator</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file)</code> <div class="block">Returns an Iterator for the lines in a <code>File</code> using the default encoding for the VM.</div> </td> </tr> <tr id="i48" class="altColor"> <td class="colFirst"><code>static <a href="../../../../org/apache/commons/io/LineIterator.html" title="class in org.apache.commons.io">LineIterator</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#lineIterator-java.io.File-java.lang.String-">lineIterator</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> encoding)</code> <div class="block">Returns an Iterator for the lines in a <code>File</code>.</div> </td> </tr> <tr id="i49" class="rowColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#listFiles-java.io.File-org.apache.commons.io.filefilter.IOFileFilter-org.apache.commons.io.filefilter.IOFileFilter-">listFiles</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> directory, <a href="../../../../org/apache/commons/io/filefilter/IOFileFilter.html" title="interface in org.apache.commons.io.filefilter">IOFileFilter</a> fileFilter, <a href="../../../../org/apache/commons/io/filefilter/IOFileFilter.html" title="interface in org.apache.commons.io.filefilter">IOFileFilter</a> dirFilter)</code> <div class="block">Finds files within a given directory (and optionally its subdirectories).</div> </td> </tr> <tr id="i50" class="altColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#listFiles-java.io.File-java.lang.String:A-boolean-">listFiles</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> directory, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[] extensions, boolean recursive)</code> <div class="block">Finds files within a given directory (and optionally its subdirectories) which match an array of extensions.</div> </td> </tr> <tr id="i51" class="rowColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#listFilesAndDirs-java.io.File-org.apache.commons.io.filefilter.IOFileFilter-org.apache.commons.io.filefilter.IOFileFilter-">listFilesAndDirs</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> directory, <a href="../../../../org/apache/commons/io/filefilter/IOFileFilter.html" title="interface in org.apache.commons.io.filefilter">IOFileFilter</a> fileFilter, <a href="../../../../org/apache/commons/io/filefilter/IOFileFilter.html" title="interface in org.apache.commons.io.filefilter">IOFileFilter</a> dirFilter)</code> <div class="block">Finds files within a given directory (and optionally its subdirectories).</div> </td> </tr> <tr id="i52" class="altColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#moveDirectory-java.io.File-java.io.File-">moveDirectory</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> srcDir, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destDir)</code> <div class="block">Moves a directory.</div> </td> </tr> <tr id="i53" class="rowColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#moveDirectoryToDirectory-java.io.File-java.io.File-boolean-">moveDirectoryToDirectory</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> src, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destDir, boolean createDestDir)</code> <div class="block">Moves a directory to another directory.</div> </td> </tr> <tr id="i54" class="altColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#moveFile-java.io.File-java.io.File-">moveFile</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> srcFile, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destFile)</code> <div class="block">Moves a file.</div> </td> </tr> <tr id="i55" class="rowColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#moveFileToDirectory-java.io.File-java.io.File-boolean-">moveFileToDirectory</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> srcFile, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destDir, boolean createDestDir)</code> <div class="block">Moves a file to a directory.</div> </td> </tr> <tr id="i56" class="altColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#moveToDirectory-java.io.File-java.io.File-boolean-">moveToDirectory</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> src, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destDir, boolean createDestDir)</code> <div class="block">Moves a file or directory to the destination directory.</div> </td> </tr> <tr id="i57" class="rowColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/io/FileInputStream.html?is-external=true" title="class or interface in java.io">FileInputStream</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#openInputStream-java.io.File-">openInputStream</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file)</code> <div class="block">Opens a <a href="http://docs.oracle.com/javase/7/docs/api/java/io/FileInputStream.html?is-external=true" title="class or interface in java.io"><code>FileInputStream</code></a> for the specified file, providing better error messages than simply calling <code>new FileInputStream(file)</code>.</div> </td> </tr> <tr id="i58" class="altColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/io/FileOutputStream.html?is-external=true" title="class or interface in java.io">FileOutputStream</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#openOutputStream-java.io.File-">openOutputStream</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file)</code> <div class="block">Opens a <a href="http://docs.oracle.com/javase/7/docs/api/java/io/FileOutputStream.html?is-external=true" title="class or interface in java.io"><code>FileOutputStream</code></a> for the specified file, checking and creating the parent directory if it does not exist.</div> </td> </tr> <tr id="i59" class="rowColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/io/FileOutputStream.html?is-external=true" title="class or interface in java.io">FileOutputStream</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#openOutputStream-java.io.File-boolean-">openOutputStream</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, boolean append)</code> <div class="block">Opens a <a href="http://docs.oracle.com/javase/7/docs/api/java/io/FileOutputStream.html?is-external=true" title="class or interface in java.io"><code>FileOutputStream</code></a> for the specified file, checking and creating the parent directory if it does not exist.</div> </td> </tr> <tr id="i60" class="altColor"> <td class="colFirst"><code>static byte[]</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#readFileToByteArray-java.io.File-">readFileToByteArray</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file)</code> <div class="block">Reads the contents of a file into a byte array.</div> </td> </tr> <tr id="i61" class="rowColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/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/commons/io/FileUtils.html#readFileToString-java.io.File-">readFileToString</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file)</code> <div class="block"><span class="deprecatedLabel">Deprecated.</span> <div class="block"><span class="deprecationComment">2.5 use <a href="../../../../org/apache/commons/io/FileUtils.html#readFileToString-java.io.File-java.nio.charset.Charset-"><code>readFileToString(File, Charset)</code></a> instead (and specify the appropriate encoding)</span></div> </div> </td> </tr> <tr id="i62" class="altColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/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/commons/io/FileUtils.html#readFileToString-java.io.File-java.nio.charset.Charset-">readFileToString</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html?is-external=true" title="class or interface in java.nio.charset">Charset</a> encoding)</code> <div class="block">Reads the contents of a file into a String.</div> </td> </tr> <tr id="i63" class="rowColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/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/commons/io/FileUtils.html#readFileToString-java.io.File-java.lang.String-">readFileToString</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> encoding)</code> <div class="block">Reads the contents of a file into a String.</div> </td> </tr> <tr id="i64" class="altColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="http://docs.oracle.com/javase/7/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/commons/io/FileUtils.html#readLines-java.io.File-">readLines</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file)</code> <div class="block"><span class="deprecatedLabel">Deprecated.</span> <div class="block"><span class="deprecationComment">2.5 use <a href="../../../../org/apache/commons/io/FileUtils.html#readLines-java.io.File-java.nio.charset.Charset-"><code>readLines(File, Charset)</code></a> instead (and specify the appropriate encoding)</span></div> </div> </td> </tr> <tr id="i65" class="rowColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="http://docs.oracle.com/javase/7/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/commons/io/FileUtils.html#readLines-java.io.File-java.nio.charset.Charset-">readLines</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html?is-external=true" title="class or interface in java.nio.charset">Charset</a> encoding)</code> <div class="block">Reads the contents of a file line by line to a List of Strings.</div> </td> </tr> <tr id="i66" class="altColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="http://docs.oracle.com/javase/7/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/commons/io/FileUtils.html#readLines-java.io.File-java.lang.String-">readLines</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> encoding)</code> <div class="block">Reads the contents of a file line by line to a List of Strings.</div> </td> </tr> <tr id="i67" class="rowColor"> <td class="colFirst"><code>static long</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#sizeOf-java.io.File-">sizeOf</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file)</code> <div class="block">Returns the size of the specified file or directory.</div> </td> </tr> <tr id="i68" class="altColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#sizeOfAsBigInteger-java.io.File-">sizeOfAsBigInteger</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file)</code> <div class="block">Returns the size of the specified file or directory.</div> </td> </tr> <tr id="i69" class="rowColor"> <td class="colFirst"><code>static long</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#sizeOfDirectory-java.io.File-">sizeOfDirectory</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> directory)</code> <div class="block">Counts the size of a directory recursively (sum of the length of all files).</div> </td> </tr> <tr id="i70" class="altColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#sizeOfDirectoryAsBigInteger-java.io.File-">sizeOfDirectoryAsBigInteger</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> directory)</code> <div class="block">Counts the size of a directory recursively (sum of the length of all files).</div> </td> </tr> <tr id="i71" class="rowColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#toFile-java.net.URL-">toFile</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</a> url)</code> <div class="block">Convert from a <code>URL</code> to a <code>File</code>.</div> </td> </tr> <tr id="i72" class="altColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>[]</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#toFiles-java.net.URL:A-">toFiles</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</a>[] urls)</code> <div class="block">Converts each of an array of <code>URL</code> to a <code>File</code>.</div> </td> </tr> <tr id="i73" class="rowColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#touch-java.io.File-">touch</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file)</code> <div class="block">Implements the same behaviour as the "touch" utility on Unix.</div> </td> </tr> <tr id="i74" class="altColor"> <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</a>[]</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#toURLs-java.io.File:A-">toURLs</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>[] files)</code> <div class="block">Converts each of an array of <code>File</code> to a <code>URL</code>.</div> </td> </tr> <tr id="i75" class="rowColor"> <td class="colFirst"><code>static boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#waitFor-java.io.File-int-">waitFor</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, int seconds)</code> <div class="block">Waits for NFS to propagate a file creation, imposing a timeout.</div> </td> </tr> <tr id="i76" class="altColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#write-java.io.File-java.lang.CharSequence-">write</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</a> data)</code> <div class="block"><span class="deprecatedLabel">Deprecated.</span> <div class="block"><span class="deprecationComment">2.5 use <a href="../../../../org/apache/commons/io/FileUtils.html#write-java.io.File-java.lang.CharSequence-java.nio.charset.Charset-"><code>write(File, CharSequence, Charset)</code></a> instead (and specify the appropriate encoding)</span></div> </div> </td> </tr> <tr id="i77" class="rowColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#write-java.io.File-java.lang.CharSequence-boolean-">write</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</a> data, boolean append)</code> <div class="block"><span class="deprecatedLabel">Deprecated.</span> <div class="block"><span class="deprecationComment">2.5 use <a href="../../../../org/apache/commons/io/FileUtils.html#write-java.io.File-java.lang.CharSequence-java.nio.charset.Charset-boolean-"><code>write(File, CharSequence, Charset, boolean)</code></a> instead (and specify the appropriate encoding)</span></div> </div> </td> </tr> <tr id="i78" class="altColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#write-java.io.File-java.lang.CharSequence-java.nio.charset.Charset-">write</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</a> data, <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html?is-external=true" title="class or interface in java.nio.charset">Charset</a> encoding)</code> <div class="block">Writes a CharSequence to a file creating the file if it does not exist.</div> </td> </tr> <tr id="i79" class="rowColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#write-java.io.File-java.lang.CharSequence-java.nio.charset.Charset-boolean-">write</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</a> data, <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html?is-external=true" title="class or interface in java.nio.charset">Charset</a> encoding, boolean append)</code> <div class="block">Writes a CharSequence to a file creating the file if it does not exist.</div> </td> </tr> <tr id="i80" class="altColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#write-java.io.File-java.lang.CharSequence-java.lang.String-">write</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</a> data, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> encoding)</code> <div class="block">Writes a CharSequence to a file creating the file if it does not exist.</div> </td> </tr> <tr id="i81" class="rowColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#write-java.io.File-java.lang.CharSequence-java.lang.String-boolean-">write</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</a> data, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> encoding, boolean append)</code> <div class="block">Writes a CharSequence to a file creating the file if it does not exist.</div> </td> </tr> <tr id="i82" class="altColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#writeByteArrayToFile-java.io.File-byte:A-">writeByteArrayToFile</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, byte[] data)</code> <div class="block">Writes a byte array to a file creating the file if it does not exist.</div> </td> </tr> <tr id="i83" class="rowColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#writeByteArrayToFile-java.io.File-byte:A-boolean-">writeByteArrayToFile</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, byte[] data, boolean append)</code> <div class="block">Writes a byte array to a file creating the file if it does not exist.</div> </td> </tr> <tr id="i84" class="altColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#writeByteArrayToFile-java.io.File-byte:A-int-int-">writeByteArrayToFile</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, byte[] data, int off, int len)</code> <div class="block">Writes <code>len</code> bytes from the specified byte array starting at offset <code>off</code> to a file, creating the file if it does not exist.</div> </td> </tr> <tr id="i85" class="rowColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#writeByteArrayToFile-java.io.File-byte:A-int-int-boolean-">writeByteArrayToFile</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, byte[] data, int off, int len, boolean append)</code> <div class="block">Writes <code>len</code> bytes from the specified byte array starting at offset <code>off</code> to a file, creating the file if it does not exist.</div> </td> </tr> <tr id="i86" class="altColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#writeLines-java.io.File-java.util.Collection-">writeLines</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><?> lines)</code> <div class="block">Writes the <code>toString()</code> value of each item in a collection to the specified <code>File</code> line by line.</div> </td> </tr> <tr id="i87" class="rowColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#writeLines-java.io.File-java.util.Collection-boolean-">writeLines</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><?> lines, boolean append)</code> <div class="block">Writes the <code>toString()</code> value of each item in a collection to the specified <code>File</code> line by line.</div> </td> </tr> <tr id="i88" class="altColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#writeLines-java.io.File-java.util.Collection-java.lang.String-">writeLines</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><?> lines, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> lineEnding)</code> <div class="block">Writes the <code>toString()</code> value of each item in a collection to the specified <code>File</code> line by line.</div> </td> </tr> <tr id="i89" class="rowColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#writeLines-java.io.File-java.util.Collection-java.lang.String-boolean-">writeLines</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><?> lines, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> lineEnding, boolean append)</code> <div class="block">Writes the <code>toString()</code> value of each item in a collection to the specified <code>File</code> line by line.</div> </td> </tr> <tr id="i90" class="altColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#writeLines-java.io.File-java.lang.String-java.util.Collection-">writeLines</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> encoding, <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><?> lines)</code> <div class="block">Writes the <code>toString()</code> value of each item in a collection to the specified <code>File</code> line by line.</div> </td> </tr> <tr id="i91" class="rowColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#writeLines-java.io.File-java.lang.String-java.util.Collection-boolean-">writeLines</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> encoding, <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><?> lines, boolean append)</code> <div class="block">Writes the <code>toString()</code> value of each item in a collection to the specified <code>File</code> line by line, optionally appending.</div> </td> </tr> <tr id="i92" class="altColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#writeLines-java.io.File-java.lang.String-java.util.Collection-java.lang.String-">writeLines</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> encoding, <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><?> lines, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> lineEnding)</code> <div class="block">Writes the <code>toString()</code> value of each item in a collection to the specified <code>File</code> line by line.</div> </td> </tr> <tr id="i93" class="rowColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#writeLines-java.io.File-java.lang.String-java.util.Collection-java.lang.String-boolean-">writeLines</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> encoding, <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><?> lines, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> lineEnding, boolean append)</code> <div class="block">Writes the <code>toString()</code> value of each item in a collection to the specified <code>File</code> line by line.</div> </td> </tr> <tr id="i94" class="altColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#writeStringToFile-java.io.File-java.lang.String-">writeStringToFile</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> data)</code> <div class="block"><span class="deprecatedLabel">Deprecated.</span> <div class="block"><span class="deprecationComment">2.5 use <a href="../../../../org/apache/commons/io/FileUtils.html#writeStringToFile-java.io.File-java.lang.String-java.nio.charset.Charset-"><code>writeStringToFile(File, String, Charset)</code></a> instead (and specify the appropriate encoding)</span></div> </div> </td> </tr> <tr id="i95" class="rowColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#writeStringToFile-java.io.File-java.lang.String-boolean-">writeStringToFile</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> data, boolean append)</code> <div class="block"><span class="deprecatedLabel">Deprecated.</span> <div class="block"><span class="deprecationComment">2.5 use <a href="../../../../org/apache/commons/io/FileUtils.html#writeStringToFile-java.io.File-java.lang.String-java.nio.charset.Charset-boolean-"><code>writeStringToFile(File, String, Charset, boolean)</code></a> instead (and specify the appropriate encoding)</span></div> </div> </td> </tr> <tr id="i96" class="altColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#writeStringToFile-java.io.File-java.lang.String-java.nio.charset.Charset-">writeStringToFile</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> data, <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html?is-external=true" title="class or interface in java.nio.charset">Charset</a> encoding)</code> <div class="block">Writes a String to a file creating the file if it does not exist.</div> </td> </tr> <tr id="i97" class="rowColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#writeStringToFile-java.io.File-java.lang.String-java.nio.charset.Charset-boolean-">writeStringToFile</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> data, <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html?is-external=true" title="class or interface in java.nio.charset">Charset</a> encoding, boolean append)</code> <div class="block">Writes a String to a file creating the file if it does not exist.</div> </td> </tr> <tr id="i98" class="altColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#writeStringToFile-java.io.File-java.lang.String-java.lang.String-">writeStringToFile</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> data, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> encoding)</code> <div class="block">Writes a String to a file creating the file if it does not exist.</div> </td> </tr> <tr id="i99" class="rowColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileUtils.html#writeStringToFile-java.io.File-java.lang.String-java.lang.String-boolean-">writeStringToFile</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> data, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> encoding, boolean append)</code> <div class="block">Writes a String to a file creating the file if it does not exist.</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="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> <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-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="ONE_KB"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>ONE_KB</h4> <pre>public static final long ONE_KB</pre> <div class="block">The number of bytes in a kilobyte.</div> <dl> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../../../../constant-values.html#org.apache.commons.io.FileUtils.ONE_KB">Constant Field Values</a></dd> </dl> </li> </ul> <a name="ONE_KB_BI"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>ONE_KB_BI</h4> <pre>public static final <a href="http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a> ONE_KB_BI</pre> <div class="block">The number of bytes in a kilobyte.</div> <dl> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.4</dd> </dl> </li> </ul> <a name="ONE_MB"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>ONE_MB</h4> <pre>public static final long ONE_MB</pre> <div class="block">The number of bytes in a megabyte.</div> <dl> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../../../../constant-values.html#org.apache.commons.io.FileUtils.ONE_MB">Constant Field Values</a></dd> </dl> </li> </ul> <a name="ONE_MB_BI"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>ONE_MB_BI</h4> <pre>public static final <a href="http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a> ONE_MB_BI</pre> <div class="block">The number of bytes in a megabyte.</div> <dl> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.4</dd> </dl> </li> </ul> <a name="ONE_GB"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>ONE_GB</h4> <pre>public static final long ONE_GB</pre> <div class="block">The number of bytes in a gigabyte.</div> <dl> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../../../../constant-values.html#org.apache.commons.io.FileUtils.ONE_GB">Constant Field Values</a></dd> </dl> </li> </ul> <a name="ONE_GB_BI"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>ONE_GB_BI</h4> <pre>public static final <a href="http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a> ONE_GB_BI</pre> <div class="block">The number of bytes in a gigabyte.</div> <dl> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.4</dd> </dl> </li> </ul> <a name="ONE_TB"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>ONE_TB</h4> <pre>public static final long ONE_TB</pre> <div class="block">The number of bytes in a terabyte.</div> <dl> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../../../../constant-values.html#org.apache.commons.io.FileUtils.ONE_TB">Constant Field Values</a></dd> </dl> </li> </ul> <a name="ONE_TB_BI"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>ONE_TB_BI</h4> <pre>public static final <a href="http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a> ONE_TB_BI</pre> <div class="block">The number of bytes in a terabyte.</div> <dl> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.4</dd> </dl> </li> </ul> <a name="ONE_PB"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>ONE_PB</h4> <pre>public static final long ONE_PB</pre> <div class="block">The number of bytes in a petabyte.</div> <dl> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../../../../constant-values.html#org.apache.commons.io.FileUtils.ONE_PB">Constant Field Values</a></dd> </dl> </li> </ul> <a name="ONE_PB_BI"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>ONE_PB_BI</h4> <pre>public static final <a href="http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a> ONE_PB_BI</pre> <div class="block">The number of bytes in a petabyte.</div> <dl> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.4</dd> </dl> </li> </ul> <a name="ONE_EB"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>ONE_EB</h4> <pre>public static final long ONE_EB</pre> <div class="block">The number of bytes in an exabyte.</div> <dl> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../../../../constant-values.html#org.apache.commons.io.FileUtils.ONE_EB">Constant Field Values</a></dd> </dl> </li> </ul> <a name="ONE_EB_BI"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>ONE_EB_BI</h4> <pre>public static final <a href="http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a> ONE_EB_BI</pre> <div class="block">The number of bytes in an exabyte.</div> <dl> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.4</dd> </dl> </li> </ul> <a name="ONE_ZB"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>ONE_ZB</h4> <pre>public static final <a href="http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a> ONE_ZB</pre> <div class="block">The number of bytes in a zettabyte.</div> </li> </ul> <a name="ONE_YB"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>ONE_YB</h4> <pre>public static final <a href="http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a> ONE_YB</pre> <div class="block">The number of bytes in a yottabyte.</div> </li> </ul> <a name="EMPTY_FILE_ARRAY"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>EMPTY_FILE_ARRAY</h4> <pre>public static final <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>[] EMPTY_FILE_ARRAY</pre> <div class="block">An empty array of type <code>File</code>.</div> </li> </ul> </li> </ul> <!-- ========= CONSTRUCTOR DETAIL ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor.detail"> <!-- --> </a> <h3>Constructor Detail</h3> <a name="FileUtils--"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>FileUtils</h4> <pre>public FileUtils()</pre> <div class="block">Instances should NOT be constructed in standard programming.</div> </li> </ul> </li> </ul> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method.detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="getFile-java.io.File-java.lang.String...-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getFile</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> getFile(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> directory, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... names)</pre> <div class="block">Construct a file from the set of name elements.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>directory</code> - the parent directory</dd> <dd><code>names</code> - the name elements</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>the file</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.1</dd> </dl> </li> </ul> <a name="getFile-java.lang.String...-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getFile</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> getFile(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... names)</pre> <div class="block">Construct a file from the set of name elements.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>names</code> - the name elements</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>the file</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.1</dd> </dl> </li> </ul> <a name="getTempDirectoryPath--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getTempDirectoryPath</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> getTempDirectoryPath()</pre> <div class="block">Returns the path to the system temporary directory.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>the path to the system temporary directory.</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.0</dd> </dl> </li> </ul> <a name="getTempDirectory--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getTempDirectory</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> getTempDirectory()</pre> <div class="block">Returns a <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io"><code>File</code></a> representing the system temporary directory.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>the system temporary directory.</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.0</dd> </dl> </li> </ul> <a name="getUserDirectoryPath--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getUserDirectoryPath</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> getUserDirectoryPath()</pre> <div class="block">Returns the path to the user's home directory.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>the path to the user's home directory.</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.0</dd> </dl> </li> </ul> <a name="getUserDirectory--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getUserDirectory</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> getUserDirectory()</pre> <div class="block">Returns a <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io"><code>File</code></a> representing the user's home directory.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>the user's home directory.</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.0</dd> </dl> </li> </ul> <a name="openInputStream-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>openInputStream</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/io/FileInputStream.html?is-external=true" title="class or interface in java.io">FileInputStream</a> openInputStream(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file) 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> <div class="block">Opens a <a href="http://docs.oracle.com/javase/7/docs/api/java/io/FileInputStream.html?is-external=true" title="class or interface in java.io"><code>FileInputStream</code></a> for the specified file, providing better error messages than simply calling <code>new FileInputStream(file)</code>. <p> At the end of the method either the stream will be successfully opened, or an exception will have been thrown. <p> An exception is thrown if the file does not exist. An exception is thrown if the file object exists but is a directory. An exception is thrown if the file exists but cannot be read.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to open for input, must not be <code>null</code></dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>a new <a href="http://docs.oracle.com/javase/7/docs/api/java/io/FileInputStream.html?is-external=true" title="class or interface in java.io"><code>FileInputStream</code></a> for the specified file</dd> <dt><span class="throwsLabel">Throws:</span></dt> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/FileNotFoundException.html?is-external=true" title="class or interface in java.io">FileNotFoundException</a></code> - if the file does not exist</dd> <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 the file object is a directory</dd> <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 the file cannot be read</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.3</dd> </dl> </li> </ul> <a name="openOutputStream-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>openOutputStream</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/io/FileOutputStream.html?is-external=true" title="class or interface in java.io">FileOutputStream</a> openOutputStream(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file) 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> <div class="block">Opens a <a href="http://docs.oracle.com/javase/7/docs/api/java/io/FileOutputStream.html?is-external=true" title="class or interface in java.io"><code>FileOutputStream</code></a> for the specified file, checking and creating the parent directory if it does not exist. <p> At the end of the method either the stream will be successfully opened, or an exception will have been thrown. <p> The parent directory will be created if it does not exist. The file will be created if it does not exist. An exception is thrown if the file object exists but is a directory. An exception is thrown if the file exists but cannot be written to. An exception is thrown if the parent directory cannot be created.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to open for output, must not be <code>null</code></dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>a new <a href="http://docs.oracle.com/javase/7/docs/api/java/io/FileOutputStream.html?is-external=true" title="class or interface in java.io"><code>FileOutputStream</code></a> for the specified file</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 the file object is a directory</dd> <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 the file cannot be written to</dd> <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 a parent directory needs creating but that fails</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.3</dd> </dl> </li> </ul> <a name="openOutputStream-java.io.File-boolean-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>openOutputStream</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/io/FileOutputStream.html?is-external=true" title="class or interface in java.io">FileOutputStream</a> openOutputStream(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, boolean append) 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> <div class="block">Opens a <a href="http://docs.oracle.com/javase/7/docs/api/java/io/FileOutputStream.html?is-external=true" title="class or interface in java.io"><code>FileOutputStream</code></a> for the specified file, checking and creating the parent directory if it does not exist. <p> At the end of the method either the stream will be successfully opened, or an exception will have been thrown. <p> The parent directory will be created if it does not exist. The file will be created if it does not exist. An exception is thrown if the file object exists but is a directory. An exception is thrown if the file exists but cannot be written to. An exception is thrown if the parent directory cannot be created.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to open for output, must not be <code>null</code></dd> <dd><code>append</code> - if <code>true</code>, then bytes will be added to the end of the file rather than overwriting</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>a new <a href="http://docs.oracle.com/javase/7/docs/api/java/io/FileOutputStream.html?is-external=true" title="class or interface in java.io"><code>FileOutputStream</code></a> for the specified file</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 the file object is a directory</dd> <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 the file cannot be written to</dd> <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 a parent directory needs creating but that fails</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.1</dd> </dl> </li> </ul> <a name="byteCountToDisplaySize-java.math.BigInteger-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>byteCountToDisplaySize</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> byteCountToDisplaySize(<a href="http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a> size)</pre> <div class="block">Returns a human-readable version of the file size, where the input represents a specific number of bytes. <p> If the size is over 1GB, the size is returned as the number of whole GB, i.e. the size is rounded down to the nearest GB boundary. </p> <p> Similarly for the 1MB and 1KB boundaries. </p></div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>size</code> - the number of bytes</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>a human-readable display value (includes units - EB, PB, TB, GB, MB, KB or bytes)</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.4</dd> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="https://issues.apache.org/jira/browse/IO-226">IO-226 - should the rounding be changed?</a></dd> </dl> </li> </ul> <a name="byteCountToDisplaySize-long-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>byteCountToDisplaySize</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> byteCountToDisplaySize(long size)</pre> <div class="block">Returns a human-readable version of the file size, where the input represents a specific number of bytes. <p> If the size is over 1GB, the size is returned as the number of whole GB, i.e. the size is rounded down to the nearest GB boundary. </p> <p> Similarly for the 1MB and 1KB boundaries. </p></div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>size</code> - the number of bytes</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>a human-readable display value (includes units - EB, PB, TB, GB, MB, KB or bytes)</dd> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="https://issues.apache.org/jira/browse/IO-226">IO-226 - should the rounding be changed?</a></dd> </dl> </li> </ul> <a name="touch-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>touch</h4> <pre>public static void touch(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file) 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> <div class="block">Implements the same behaviour as the "touch" utility on Unix. It creates a new file with size 0 or, if the file exists already, it is opened and closed without modifying it, but updating the file date and time. <p> NOTE: As from v1.3, this method throws an IOException if the last modified date of the file cannot be set. Also, as from v1.3 this method creates parent directories if they do not exist.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the File to touch</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 problem occurs</dd> </dl> </li> </ul> <a name="convertFileCollectionToFileArray-java.util.Collection-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>convertFileCollectionToFileArray</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>[] convertFileCollectionToFileArray(<a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>> files)</pre> <div class="block">Converts a Collection containing java.io.File instanced into array representation. This is to account for the difference between File.listFiles() and FileUtils.listFiles().</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>files</code> - a Collection containing java.io.File instances</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>an array of java.io.File</dd> </dl> </li> </ul> <a name="listFiles-java.io.File-org.apache.commons.io.filefilter.IOFileFilter-org.apache.commons.io.filefilter.IOFileFilter-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>listFiles</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>> listFiles(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> directory, <a href="../../../../org/apache/commons/io/filefilter/IOFileFilter.html" title="interface in org.apache.commons.io.filefilter">IOFileFilter</a> fileFilter, <a href="../../../../org/apache/commons/io/filefilter/IOFileFilter.html" title="interface in org.apache.commons.io.filefilter">IOFileFilter</a> dirFilter)</pre> <div class="block">Finds files within a given directory (and optionally its subdirectories). All files found are filtered by an IOFileFilter. <p> If your search should recurse into subdirectories you can pass in an IOFileFilter for directories. You don't need to bind a DirectoryFileFilter (via logical AND) to this filter. This method does that for you. <p> An example: If you want to search through all directories called "temp" you pass in <code>FileFilterUtils.NameFileFilter("temp")</code> <p> Another common usage of this method is find files in a directory tree but ignoring the directories generated CVS. You can simply pass in <code>FileFilterUtils.makeCVSAware(null)</code>.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>directory</code> - the directory to search in</dd> <dd><code>fileFilter</code> - filter to apply when finding files. Must not be <code>null</code>, use <a href="../../../../org/apache/commons/io/filefilter/TrueFileFilter.html#INSTANCE"><code>TrueFileFilter.INSTANCE</code></a> to match all files in selected directories.</dd> <dd><code>dirFilter</code> - optional filter to apply when finding subdirectories. If this parameter is <code>null</code>, subdirectories will not be included in the search. Use <a href="../../../../org/apache/commons/io/filefilter/TrueFileFilter.html#INSTANCE"><code>TrueFileFilter.INSTANCE</code></a> to match all directories.</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>a collection of java.io.File with the matching files</dd> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../../../../org/apache/commons/io/filefilter/FileFilterUtils.html" title="class in org.apache.commons.io.filefilter"><code>FileFilterUtils</code></a>, <a href="../../../../org/apache/commons/io/filefilter/NameFileFilter.html" title="class in org.apache.commons.io.filefilter"><code>NameFileFilter</code></a></dd> </dl> </li> </ul> <a name="listFilesAndDirs-java.io.File-org.apache.commons.io.filefilter.IOFileFilter-org.apache.commons.io.filefilter.IOFileFilter-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>listFilesAndDirs</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>> listFilesAndDirs(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> directory, <a href="../../../../org/apache/commons/io/filefilter/IOFileFilter.html" title="interface in org.apache.commons.io.filefilter">IOFileFilter</a> fileFilter, <a href="../../../../org/apache/commons/io/filefilter/IOFileFilter.html" title="interface in org.apache.commons.io.filefilter">IOFileFilter</a> dirFilter)</pre> <div class="block">Finds files within a given directory (and optionally its subdirectories). All files found are filtered by an IOFileFilter. <p> The resulting collection includes the starting directory and any subdirectories that match the directory filter. <p></div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>directory</code> - the directory to search in</dd> <dd><code>fileFilter</code> - filter to apply when finding files.</dd> <dd><code>dirFilter</code> - optional filter to apply when finding subdirectories. If this parameter is <code>null</code>, subdirectories will not be included in the search. Use TrueFileFilter.INSTANCE to match all directories.</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>a collection of java.io.File with the matching files</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.2</dd> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../../../../org/apache/commons/io/FileUtils.html#listFiles-java.io.File-org.apache.commons.io.filefilter.IOFileFilter-org.apache.commons.io.filefilter.IOFileFilter-"><code>listFiles(java.io.File, org.apache.commons.io.filefilter.IOFileFilter, org.apache.commons.io.filefilter.IOFileFilter)</code></a>, <a href="../../../../org/apache/commons/io/filefilter/FileFilterUtils.html" title="class in org.apache.commons.io.filefilter"><code>FileFilterUtils</code></a>, <a href="../../../../org/apache/commons/io/filefilter/NameFileFilter.html" title="class in org.apache.commons.io.filefilter"><code>NameFileFilter</code></a></dd> </dl> </li> </ul> <a name="iterateFiles-java.io.File-org.apache.commons.io.filefilter.IOFileFilter-org.apache.commons.io.filefilter.IOFileFilter-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>iterateFiles</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>> iterateFiles(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> directory, <a href="../../../../org/apache/commons/io/filefilter/IOFileFilter.html" title="interface in org.apache.commons.io.filefilter">IOFileFilter</a> fileFilter, <a href="../../../../org/apache/commons/io/filefilter/IOFileFilter.html" title="interface in org.apache.commons.io.filefilter">IOFileFilter</a> dirFilter)</pre> <div class="block">Allows iteration over the files in given directory (and optionally its subdirectories). <p> All files found are filtered by an IOFileFilter. This method is based on <a href="../../../../org/apache/commons/io/FileUtils.html#listFiles-java.io.File-org.apache.commons.io.filefilter.IOFileFilter-org.apache.commons.io.filefilter.IOFileFilter-"><code>listFiles(File, IOFileFilter, IOFileFilter)</code></a>, which supports Iterable ('foreach' loop). <p></div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>directory</code> - the directory to search in</dd> <dd><code>fileFilter</code> - filter to apply when finding files.</dd> <dd><code>dirFilter</code> - optional filter to apply when finding subdirectories. If this parameter is <code>null</code>, subdirectories will not be included in the search. Use TrueFileFilter.INSTANCE to match all directories.</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>an iterator of java.io.File for the matching files</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.2</dd> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../../../../org/apache/commons/io/filefilter/FileFilterUtils.html" title="class in org.apache.commons.io.filefilter"><code>FileFilterUtils</code></a>, <a href="../../../../org/apache/commons/io/filefilter/NameFileFilter.html" title="class in org.apache.commons.io.filefilter"><code>NameFileFilter</code></a></dd> </dl> </li> </ul> <a name="iterateFilesAndDirs-java.io.File-org.apache.commons.io.filefilter.IOFileFilter-org.apache.commons.io.filefilter.IOFileFilter-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>iterateFilesAndDirs</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>> iterateFilesAndDirs(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> directory, <a href="../../../../org/apache/commons/io/filefilter/IOFileFilter.html" title="interface in org.apache.commons.io.filefilter">IOFileFilter</a> fileFilter, <a href="../../../../org/apache/commons/io/filefilter/IOFileFilter.html" title="interface in org.apache.commons.io.filefilter">IOFileFilter</a> dirFilter)</pre> <div class="block">Allows iteration over the files in given directory (and optionally its subdirectories). <p> All files found are filtered by an IOFileFilter. This method is based on <a href="../../../../org/apache/commons/io/FileUtils.html#listFilesAndDirs-java.io.File-org.apache.commons.io.filefilter.IOFileFilter-org.apache.commons.io.filefilter.IOFileFilter-"><code>listFilesAndDirs(File, IOFileFilter, IOFileFilter)</code></a>, which supports Iterable ('foreach' loop). <p> The resulting iterator includes the subdirectories themselves.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>directory</code> - the directory to search in</dd> <dd><code>fileFilter</code> - filter to apply when finding files.</dd> <dd><code>dirFilter</code> - optional filter to apply when finding subdirectories. If this parameter is <code>null</code>, subdirectories will not be included in the search. Use TrueFileFilter.INSTANCE to match all directories.</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>an iterator of java.io.File for the matching files</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.2</dd> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../../../../org/apache/commons/io/filefilter/FileFilterUtils.html" title="class in org.apache.commons.io.filefilter"><code>FileFilterUtils</code></a>, <a href="../../../../org/apache/commons/io/filefilter/NameFileFilter.html" title="class in org.apache.commons.io.filefilter"><code>NameFileFilter</code></a></dd> </dl> </li> </ul> <a name="listFiles-java.io.File-java.lang.String:A-boolean-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>listFiles</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>> listFiles(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> directory, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[] extensions, boolean recursive)</pre> <div class="block">Finds files within a given directory (and optionally its subdirectories) which match an array of extensions.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>directory</code> - the directory to search in</dd> <dd><code>extensions</code> - an array of extensions, ex. {"java","xml"}. If this parameter is <code>null</code>, all files are returned.</dd> <dd><code>recursive</code> - if true all subdirectories are searched as well</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>a collection of java.io.File with the matching files</dd> </dl> </li> </ul> <a name="iterateFiles-java.io.File-java.lang.String:A-boolean-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>iterateFiles</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>> iterateFiles(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> directory, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[] extensions, boolean recursive)</pre> <div class="block">Allows iteration over the files in a given directory (and optionally its subdirectories) which match an array of extensions. This method is based on <a href="../../../../org/apache/commons/io/FileUtils.html#listFiles-java.io.File-java.lang.String:A-boolean-"><code>listFiles(File, String[], boolean)</code></a>, which supports Iterable ('foreach' loop).</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>directory</code> - the directory to search in</dd> <dd><code>extensions</code> - an array of extensions, ex. {"java","xml"}. If this parameter is <code>null</code>, all files are returned.</dd> <dd><code>recursive</code> - if true all subdirectories are searched as well</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>an iterator of java.io.File with the matching files</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.2</dd> </dl> </li> </ul> <a name="contentEquals-java.io.File-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>contentEquals</h4> <pre>public static boolean contentEquals(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file1, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file2) 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> <div class="block">Compares the contents of two files to determine if they are equal or not. <p> This method checks to see if the two files are different lengths or if they point to the same file, before resorting to byte-by-byte comparison of the contents. <p> Code origin: Avalon</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file1</code> - the first file</dd> <dd><code>file2</code> - the second file</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>true if the content of the files are equal or they both don't exist, false otherwise</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> </dl> </li> </ul> <a name="contentEqualsIgnoreEOL-java.io.File-java.io.File-java.lang.String-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>contentEqualsIgnoreEOL</h4> <pre>public static boolean contentEqualsIgnoreEOL(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file1, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file2, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> charsetName) 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> <div class="block">Compares the contents of two files to determine if they are equal or not. <p> This method checks to see if the two files point to the same file, before resorting to line-by-line comparison of the contents. <p></div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file1</code> - the first file</dd> <dd><code>file2</code> - the second file</dd> <dd><code>charsetName</code> - the character encoding to be used. May be null, in which case the platform default is used</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>true if the content of the files are equal or neither exists, false otherwise</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.2</dd> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../../../../org/apache/commons/io/IOUtils.html#contentEqualsIgnoreEOL-java.io.Reader-java.io.Reader-"><code>IOUtils.contentEqualsIgnoreEOL(Reader, Reader)</code></a></dd> </dl> </li> </ul> <a name="toFile-java.net.URL-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>toFile</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> toFile(<a href="http://docs.oracle.com/javase/7/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</a> url)</pre> <div class="block">Convert from a <code>URL</code> to a <code>File</code>. <p> From version 1.1 this method will decode the URL. Syntax such as <code>file:///my%20docs/file.txt</code> will be correctly decoded to <code>/my docs/file.txt</code>. Starting with version 1.5, this method uses UTF-8 to decode percent-encoded octets to characters. Additionally, malformed percent-encoded octets are handled leniently by passing them through literally.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>url</code> - the file URL to convert, <code>null</code> returns <code>null</code></dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>the equivalent <code>File</code> object, or <code>null</code> if the URL's protocol is not <code>file</code></dd> </dl> </li> </ul> <a name="toFiles-java.net.URL:A-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>toFiles</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>[] toFiles(<a href="http://docs.oracle.com/javase/7/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</a>[] urls)</pre> <div class="block">Converts each of an array of <code>URL</code> to a <code>File</code>. <p> Returns an array of the same size as the input. If the input is <code>null</code>, an empty array is returned. If the input contains <code>null</code>, the output array contains <code>null</code> at the same index. <p> This method will decode the URL. Syntax such as <code>file:///my%20docs/file.txt</code> will be correctly decoded to <code>/my docs/file.txt</code>.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>urls</code> - the file URLs to convert, <code>null</code> returns empty array</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>a non-<code>null</code> array of Files matching the input, with a <code>null</code> item if there was a <code>null</code> at that index in the input array</dd> <dt><span class="throwsLabel">Throws:</span></dt> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if any file is not a URL file</dd> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if any file is incorrectly encoded</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.1</dd> </dl> </li> </ul> <a name="toURLs-java.io.File:A-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>toURLs</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</a>[] toURLs(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>[] files) 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> <div class="block">Converts each of an array of <code>File</code> to a <code>URL</code>. <p> Returns an array of the same size as the input.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>files</code> - the files to convert, must not be <code>null</code></dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>an array of URLs matching the input</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 a file cannot be converted</dd> <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 parameter is null</dd> </dl> </li> </ul> <a name="copyFileToDirectory-java.io.File-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>copyFileToDirectory</h4> <pre>public static void copyFileToDirectory(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> srcFile, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destDir) 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> <div class="block">Copies a file to a directory preserving the file date. <p> This method copies the contents of the specified source file to a file of the same name in the specified destination directory. The destination directory is created if it does not exist. If the destination file exists, then this method will overwrite it. <p> <strong>Note:</strong> This method tries to preserve the file's last modified date/times using <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true#setLastModified-long-" title="class or interface in java.io"><code>File.setLastModified(long)</code></a>, however it is not guaranteed that the operation will succeed. If the modification operation fails, no indication is provided.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>srcFile</code> - an existing file to copy, must not be <code>null</code></dd> <dd><code>destDir</code> - the directory to place the copy in, must not be <code>null</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 source or destination is null</dd> <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 source or destination is invalid</dd> <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 IO error occurs during copying</dd> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../../../../org/apache/commons/io/FileUtils.html#copyFile-java.io.File-java.io.File-boolean-"><code>copyFile(File, File, boolean)</code></a></dd> </dl> </li> </ul> <a name="copyFileToDirectory-java.io.File-java.io.File-boolean-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>copyFileToDirectory</h4> <pre>public static void copyFileToDirectory(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> srcFile, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destDir, boolean preserveFileDate) 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> <div class="block">Copies a file to a directory optionally preserving the file date. <p> This method copies the contents of the specified source file to a file of the same name in the specified destination directory. The destination directory is created if it does not exist. If the destination file exists, then this method will overwrite it. <p> <strong>Note:</strong> Setting <code>preserveFileDate</code> to <code>true</code> tries to preserve the file's last modified date/times using <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true#setLastModified-long-" title="class or interface in java.io"><code>File.setLastModified(long)</code></a>, however it is not guaranteed that the operation will succeed. If the modification operation fails, no indication is provided.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>srcFile</code> - an existing file to copy, must not be <code>null</code></dd> <dd><code>destDir</code> - the directory to place the copy in, must not be <code>null</code></dd> <dd><code>preserveFileDate</code> - true if the file date of the copy should be the same as the original</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 source or destination is <code>null</code></dd> <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 source or destination is invalid</dd> <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 IO error occurs during copying</dd> <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 the output file length is not the same as the input file length after the copy completes</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.3</dd> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../../../../org/apache/commons/io/FileUtils.html#copyFile-java.io.File-java.io.File-boolean-"><code>copyFile(File, File, boolean)</code></a></dd> </dl> </li> </ul> <a name="copyFile-java.io.File-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>copyFile</h4> <pre>public static void copyFile(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> srcFile, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destFile) 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> <div class="block">Copies a file to a new location preserving the file date. <p> This method copies the contents of the specified source file to the specified destination file. The directory holding the destination file is created if it does not exist. If the destination file exists, then this method will overwrite it. <p> <strong>Note:</strong> This method tries to preserve the file's last modified date/times using <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true#setLastModified-long-" title="class or interface in java.io"><code>File.setLastModified(long)</code></a>, however it is not guaranteed that the operation will succeed. If the modification operation fails, no indication is provided.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>srcFile</code> - an existing file to copy, must not be <code>null</code></dd> <dd><code>destFile</code> - the new file, must not be <code>null</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 source or destination is <code>null</code></dd> <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 source or destination is invalid</dd> <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 IO error occurs during copying</dd> <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 the output file length is not the same as the input file length after the copy completes</dd> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../../../../org/apache/commons/io/FileUtils.html#copyFileToDirectory-java.io.File-java.io.File-"><code>copyFileToDirectory(File, File)</code></a>, <a href="../../../../org/apache/commons/io/FileUtils.html#copyFile-java.io.File-java.io.File-boolean-"><code>copyFile(File, File, boolean)</code></a></dd> </dl> </li> </ul> <a name="copyFile-java.io.File-java.io.File-boolean-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>copyFile</h4> <pre>public static void copyFile(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> srcFile, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destFile, boolean preserveFileDate) 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> <div class="block">Copies a file to a new location. <p> This method copies the contents of the specified source file to the specified destination file. The directory holding the destination file is created if it does not exist. If the destination file exists, then this method will overwrite it. <p> <strong>Note:</strong> Setting <code>preserveFileDate</code> to <code>true</code> tries to preserve the file's last modified date/times using <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true#setLastModified-long-" title="class or interface in java.io"><code>File.setLastModified(long)</code></a>, however it is not guaranteed that the operation will succeed. If the modification operation fails, no indication is provided.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>srcFile</code> - an existing file to copy, must not be <code>null</code></dd> <dd><code>destFile</code> - the new file, must not be <code>null</code></dd> <dd><code>preserveFileDate</code> - true if the file date of the copy should be the same as the original</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 source or destination is <code>null</code></dd> <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 source or destination is invalid</dd> <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 IO error occurs during copying</dd> <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 the output file length is not the same as the input file length after the copy completes</dd> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../../../../org/apache/commons/io/FileUtils.html#copyFileToDirectory-java.io.File-java.io.File-boolean-"><code>copyFileToDirectory(File, File, boolean)</code></a>, <a href="../../../../org/apache/commons/io/FileUtils.html#doCopyFile-java.io.File-java.io.File-boolean-"><code>doCopyFile(File, File, boolean)</code></a></dd> </dl> </li> </ul> <a name="copyFile-java.io.File-java.io.OutputStream-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>copyFile</h4> <pre>public static long copyFile(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> input, <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> output) 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> <div class="block">Copy bytes from a <code>File</code> to an <code>OutputStream</code>. <p> This method buffers the input internally, so there is no need to use a <code>BufferedInputStream</code>. </p></div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>input</code> - the <code>File</code> to read from</dd> <dd><code>output</code> - the <code>OutputStream</code> to write to</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>the number of bytes copied</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 or output is null</dd> <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="simpleTagLabel">Since:</span></dt> <dd>2.1</dd> </dl> </li> </ul> <a name="copyDirectoryToDirectory-java.io.File-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>copyDirectoryToDirectory</h4> <pre>public static void copyDirectoryToDirectory(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> srcDir, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destDir) 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> <div class="block">Copies a directory to within another directory preserving the file dates. <p> This method copies the source directory and all its contents to a directory of the same name in the specified destination directory. <p> The destination directory is created if it does not exist. If the destination directory did exist, then this method merges the source with the destination, with the source taking precedence. <p> <strong>Note:</strong> This method tries to preserve the files' last modified date/times using <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true#setLastModified-long-" title="class or interface in java.io"><code>File.setLastModified(long)</code></a>, however it is not guaranteed that those operations will succeed. If the modification operation fails, no indication is provided.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>srcDir</code> - an existing directory to copy, must not be <code>null</code></dd> <dd><code>destDir</code> - the directory to place the copy in, must not be <code>null</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 source or destination is <code>null</code></dd> <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 source or destination is invalid</dd> <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 IO error occurs during copying</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.2</dd> </dl> </li> </ul> <a name="copyDirectory-java.io.File-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>copyDirectory</h4> <pre>public static void copyDirectory(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> srcDir, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destDir) 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> <div class="block">Copies a whole directory to a new location preserving the file dates. <p> This method copies the specified directory and all its child directories and files to the specified destination. The destination is the new location and name of the directory. <p> The destination directory is created if it does not exist. If the destination directory did exist, then this method merges the source with the destination, with the source taking precedence. <p> <strong>Note:</strong> This method tries to preserve the files' last modified date/times using <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true#setLastModified-long-" title="class or interface in java.io"><code>File.setLastModified(long)</code></a>, however it is not guaranteed that those operations will succeed. If the modification operation fails, no indication is provided.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>srcDir</code> - an existing directory to copy, must not be <code>null</code></dd> <dd><code>destDir</code> - the new directory, must not be <code>null</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 source or destination is <code>null</code></dd> <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 source or destination is invalid</dd> <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 IO error occurs during copying</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.1</dd> </dl> </li> </ul> <a name="copyDirectory-java.io.File-java.io.File-boolean-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>copyDirectory</h4> <pre>public static void copyDirectory(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> srcDir, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destDir, boolean preserveFileDate) 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> <div class="block">Copies a whole directory to a new location. <p> This method copies the contents of the specified source directory to within the specified destination directory. <p> The destination directory is created if it does not exist. If the destination directory did exist, then this method merges the source with the destination, with the source taking precedence. <p> <strong>Note:</strong> Setting <code>preserveFileDate</code> to <code>true</code> tries to preserve the files' last modified date/times using <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true#setLastModified-long-" title="class or interface in java.io"><code>File.setLastModified(long)</code></a>, however it is not guaranteed that those operations will succeed. If the modification operation fails, no indication is provided.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>srcDir</code> - an existing directory to copy, must not be <code>null</code></dd> <dd><code>destDir</code> - the new directory, must not be <code>null</code></dd> <dd><code>preserveFileDate</code> - true if the file date of the copy should be the same as the original</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 source or destination is <code>null</code></dd> <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 source or destination is invalid</dd> <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 IO error occurs during copying</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.1</dd> </dl> </li> </ul> <a name="copyDirectory-java.io.File-java.io.File-java.io.FileFilter-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>copyDirectory</h4> <pre>public static void copyDirectory(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> srcDir, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destDir, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/FileFilter.html?is-external=true" title="class or interface in java.io">FileFilter</a> filter) 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> <div class="block">Copies a filtered directory to a new location preserving the file dates. <p> This method copies the contents of the specified source directory to within the specified destination directory. <p> The destination directory is created if it does not exist. If the destination directory did exist, then this method merges the source with the destination, with the source taking precedence. <p> <strong>Note:</strong> This method tries to preserve the files' last modified date/times using <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true#setLastModified-long-" title="class or interface in java.io"><code>File.setLastModified(long)</code></a>, however it is not guaranteed that those operations will succeed. If the modification operation fails, no indication is provided. </p> <h3>Example: Copy directories only</h3> <pre> // only copy the directory structure FileUtils.copyDirectory(srcDir, destDir, DirectoryFileFilter.DIRECTORY); </pre> <h3>Example: Copy directories and txt files</h3> <pre> // Create a filter for ".txt" files IOFileFilter txtSuffixFilter = FileFilterUtils.suffixFileFilter(".txt"); IOFileFilter txtFiles = FileFilterUtils.andFileFilter(FileFileFilter.FILE, txtSuffixFilter); // Create a filter for either directories or ".txt" files FileFilter filter = FileFilterUtils.orFileFilter(DirectoryFileFilter.DIRECTORY, txtFiles); // Copy using the filter FileUtils.copyDirectory(srcDir, destDir, filter); </pre></div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>srcDir</code> - an existing directory to copy, must not be <code>null</code></dd> <dd><code>destDir</code> - the new directory, must not be <code>null</code></dd> <dd><code>filter</code> - the filter to apply, null means copy all directories and files should be the same as the original</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 source or destination is <code>null</code></dd> <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 source or destination is invalid</dd> <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 IO error occurs during copying</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.4</dd> </dl> </li> </ul> <a name="copyDirectory-java.io.File-java.io.File-java.io.FileFilter-boolean-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>copyDirectory</h4> <pre>public static void copyDirectory(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> srcDir, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destDir, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/FileFilter.html?is-external=true" title="class or interface in java.io">FileFilter</a> filter, boolean preserveFileDate) 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> <div class="block">Copies a filtered directory to a new location. <p> This method copies the contents of the specified source directory to within the specified destination directory. <p> The destination directory is created if it does not exist. If the destination directory did exist, then this method merges the source with the destination, with the source taking precedence. <p> <strong>Note:</strong> Setting <code>preserveFileDate</code> to <code>true</code> tries to preserve the files' last modified date/times using <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true#setLastModified-long-" title="class or interface in java.io"><code>File.setLastModified(long)</code></a>, however it is not guaranteed that those operations will succeed. If the modification operation fails, no indication is provided. </p> <h3>Example: Copy directories only</h3> <pre> // only copy the directory structure FileUtils.copyDirectory(srcDir, destDir, DirectoryFileFilter.DIRECTORY, false); </pre> <h3>Example: Copy directories and txt files</h3> <pre> // Create a filter for ".txt" files IOFileFilter txtSuffixFilter = FileFilterUtils.suffixFileFilter(".txt"); IOFileFilter txtFiles = FileFilterUtils.andFileFilter(FileFileFilter.FILE, txtSuffixFilter); // Create a filter for either directories or ".txt" files FileFilter filter = FileFilterUtils.orFileFilter(DirectoryFileFilter.DIRECTORY, txtFiles); // Copy using the filter FileUtils.copyDirectory(srcDir, destDir, filter, false); </pre></div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>srcDir</code> - an existing directory to copy, must not be <code>null</code></dd> <dd><code>destDir</code> - the new directory, must not be <code>null</code></dd> <dd><code>filter</code> - the filter to apply, null means copy all directories and files</dd> <dd><code>preserveFileDate</code> - true if the file date of the copy should be the same as the original</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 source or destination is <code>null</code></dd> <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 source or destination is invalid</dd> <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 IO error occurs during copying</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.4</dd> </dl> </li> </ul> <a name="copyURLToFile-java.net.URL-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>copyURLToFile</h4> <pre>public static void copyURLToFile(<a href="http://docs.oracle.com/javase/7/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</a> source, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destination) 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> <div class="block">Copies bytes from the URL <code>source</code> to a file <code>destination</code>. The directories up to <code>destination</code> will be created if they don't already exist. <code>destination</code> will be overwritten if it already exists. <p> Warning: this method does not set a connection or read timeout and thus might block forever. Use <a href="../../../../org/apache/commons/io/FileUtils.html#copyURLToFile-java.net.URL-java.io.File-int-int-"><code>copyURLToFile(URL, File, int, int)</code></a> with reasonable timeouts to prevent this.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>source</code> - the <code>URL</code> to copy bytes from, must not be <code>null</code></dd> <dd><code>destination</code> - the non-directory <code>File</code> to write bytes to (possibly overwriting), must not be <code>null</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 <code>source</code> URL cannot be opened</dd> <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 <code>destination</code> is a directory</dd> <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 <code>destination</code> cannot be written</dd> <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 <code>destination</code> needs creating but can't be</dd> <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 IO error occurs during copying</dd> </dl> </li> </ul> <a name="copyURLToFile-java.net.URL-java.io.File-int-int-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>copyURLToFile</h4> <pre>public static void copyURLToFile(<a href="http://docs.oracle.com/javase/7/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</a> source, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destination, int connectionTimeout, int readTimeout) 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> <div class="block">Copies bytes from the URL <code>source</code> to a file <code>destination</code>. The directories up to <code>destination</code> will be created if they don't already exist. <code>destination</code> will be overwritten if it already exists.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>source</code> - the <code>URL</code> to copy bytes from, must not be <code>null</code></dd> <dd><code>destination</code> - the non-directory <code>File</code> to write bytes to (possibly overwriting), must not be <code>null</code></dd> <dd><code>connectionTimeout</code> - the number of milliseconds until this method will timeout if no connection could be established to the <code>source</code></dd> <dd><code>readTimeout</code> - the number of milliseconds until this method will timeout if no data could be read from the <code>source</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 <code>source</code> URL cannot be opened</dd> <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 <code>destination</code> is a directory</dd> <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 <code>destination</code> cannot be written</dd> <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 <code>destination</code> needs creating but can't be</dd> <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 IO error occurs during copying</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.0</dd> </dl> </li> </ul> <a name="copyInputStreamToFile-java.io.InputStream-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>copyInputStreamToFile</h4> <pre>public static void copyInputStreamToFile(<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> source, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destination) 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> <div class="block">Copies bytes from an <a href="http://docs.oracle.com/javase/7/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io"><code>InputStream</code></a> <code>source</code> to a file <code>destination</code>. The directories up to <code>destination</code> will be created if they don't already exist. <code>destination</code> will be overwritten if it already exists. The <code>source</code> stream is closed. See <a href="../../../../org/apache/commons/io/FileUtils.html#copyToFile-java.io.InputStream-java.io.File-"><code>copyToFile(InputStream, File)</code></a> for a method that does not close the input stream.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>source</code> - the <code>InputStream</code> to copy bytes from, must not be <code>null</code>, will be closed</dd> <dd><code>destination</code> - the non-directory <code>File</code> to write bytes to (possibly overwriting), must not be <code>null</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 <code>destination</code> is a directory</dd> <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 <code>destination</code> cannot be written</dd> <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 <code>destination</code> needs creating but can't be</dd> <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 IO error occurs during copying</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.0</dd> </dl> </li> </ul> <a name="copyToFile-java.io.InputStream-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>copyToFile</h4> <pre>public static void copyToFile(<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> source, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destination) 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> <div class="block">Copies bytes from an <a href="http://docs.oracle.com/javase/7/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io"><code>InputStream</code></a> <code>source</code> to a file <code>destination</code>. The directories up to <code>destination</code> will be created if they don't already exist. <code>destination</code> will be overwritten if it already exists. The <code>source</code> stream is left open, e.g. for use with <a href="http://docs.oracle.com/javase/7/docs/api/java/util/zip/ZipInputStream.html?is-external=true" title="class or interface in java.util.zip"><code>ZipInputStream</code></a>. See <a href="../../../../org/apache/commons/io/FileUtils.html#copyInputStreamToFile-java.io.InputStream-java.io.File-"><code>copyInputStreamToFile(InputStream, File)</code></a> for a method that closes the input stream.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>source</code> - the <code>InputStream</code> to copy bytes from, must not be <code>null</code></dd> <dd><code>destination</code> - the non-directory <code>File</code> to write bytes to (possibly overwriting), must not be <code>null</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 <code>destination</code> is a directory</dd> <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 <code>destination</code> cannot be written</dd> <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 <code>destination</code> needs creating but can't be</dd> <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 IO error occurs during copying</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.5</dd> </dl> </li> </ul> <a name="copyToDirectory-java.io.File-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>copyToDirectory</h4> <pre>public static void copyToDirectory(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> src, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destDir) 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> <div class="block">Copies a file or directory to within another directory preserving the file dates. <p> This method copies the source file or directory, along all its contents, to a directory of the same name in the specified destination directory. <p> The destination directory is created if it does not exist. If the destination directory did exist, then this method merges the source with the destination, with the source taking precedence. <p> <strong>Note:</strong> This method tries to preserve the files' last modified date/times using <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true#setLastModified-long-" title="class or interface in java.io"><code>File.setLastModified(long)</code></a>, however it is not guaranteed that those operations will succeed. If the modification operation fails, no indication is provided.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>src</code> - an existing file or directory to copy, must not be <code>null</code></dd> <dd><code>destDir</code> - the directory to place the copy in, must not be <code>null</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 source or destination is <code>null</code></dd> <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 source or destination is invalid</dd> <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 IO error occurs during copying</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.6</dd> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../../../../org/apache/commons/io/FileUtils.html#copyDirectoryToDirectory-java.io.File-java.io.File-"><code>copyDirectoryToDirectory(File, File)</code></a>, <a href="../../../../org/apache/commons/io/FileUtils.html#copyFileToDirectory-java.io.File-java.io.File-"><code>copyFileToDirectory(File, File)</code></a></dd> </dl> </li> </ul> <a name="copyToDirectory-java.lang.Iterable-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>copyToDirectory</h4> <pre>public static void copyToDirectory(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>> srcs, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destDir) 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> <div class="block">Copies a files to a directory preserving each file's date. <p> This method copies the contents of the specified source files to a file of the same name in the specified destination directory. The destination directory is created if it does not exist. If the destination file exists, then this method will overwrite it. <p> <strong>Note:</strong> This method tries to preserve the file's last modified date/times using <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true#setLastModified-long-" title="class or interface in java.io"><code>File.setLastModified(long)</code></a>, however it is not guaranteed that the operation will succeed. If the modification operation fails, no indication is provided.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>srcs</code> - a existing files to copy, must not be <code>null</code></dd> <dd><code>destDir</code> - the directory to place the copy in, must not be <code>null</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 source or destination is null</dd> <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 source or destination is invalid</dd> <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 IO error occurs during copying</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.6</dd> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../../../../org/apache/commons/io/FileUtils.html#copyFileToDirectory-java.io.File-java.io.File-"><code>copyFileToDirectory(File, File)</code></a></dd> </dl> </li> </ul> <a name="deleteDirectory-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>deleteDirectory</h4> <pre>public static void deleteDirectory(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> directory) 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> <div class="block">Deletes a directory recursively.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>directory</code> - directory to delete</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case deletion is unsuccessful</dd> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if <code>directory</code> does not exist or is not a directory</dd> </dl> </li> </ul> <a name="deleteQuietly-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>deleteQuietly</h4> <pre>public static boolean deleteQuietly(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file)</pre> <div class="block">Deletes a file, never throwing an exception. If file is a directory, delete it and all sub-directories. <p> The difference between File.delete() and this method are: <ul> <li>A directory to be deleted does not have to be empty.</li> <li>No exceptions are thrown when a file or directory cannot be deleted.</li> </ul></div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - file or directory to delete, can be <code>null</code></dd> <dt><span class="returnLabel">Returns:</span></dt> <dd><code>true</code> if the file or directory was deleted, otherwise <code>false</code></dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.4</dd> </dl> </li> </ul> <a name="directoryContains-java.io.File-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>directoryContains</h4> <pre>public static boolean directoryContains(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> directory, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> child) 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> <div class="block">Determines whether the <code>parent</code> directory contains the <code>child</code> element (a file or directory). <p> Files are normalized before comparison. </p> Edge cases: <ul> <li>A <code>directory</code> must not be null: if null, throw IllegalArgumentException</li> <li>A <code>directory</code> must be a directory: if not a directory, throw IllegalArgumentException</li> <li>A directory does not contain itself: return false</li> <li>A null child file is not contained in any parent: return false</li> </ul></div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>directory</code> - the file to consider as the parent.</dd> <dd><code>child</code> - the file to consider as the child.</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>true is the candidate leaf is under by the specified composite. False otherwise.</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 IO error occurs while checking the files.</dd> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if <code>directory</code> is null or not a directory.</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.2</dd> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../../../../org/apache/commons/io/FilenameUtils.html#directoryContains-java.lang.String-java.lang.String-"><code>FilenameUtils.directoryContains(String, String)</code></a></dd> </dl> </li> </ul> <a name="cleanDirectory-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>cleanDirectory</h4> <pre>public static void cleanDirectory(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> directory) 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> <div class="block">Cleans a directory without deleting it.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>directory</code> - directory to clean</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case cleaning is unsuccessful</dd> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if <code>directory</code> does not exist or is not a directory</dd> </dl> </li> </ul> <a name="waitFor-java.io.File-int-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>waitFor</h4> <pre>public static boolean waitFor(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, int seconds)</pre> <div class="block">Waits for NFS to propagate a file creation, imposing a timeout. <p> This method repeatedly tests <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true#exists--" title="class or interface in java.io"><code>File.exists()</code></a> until it returns true up to the maximum time specified in seconds.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to check, must not be <code>null</code></dd> <dd><code>seconds</code> - the maximum time in seconds to wait</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>true if file exists</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 file is <code>null</code></dd> </dl> </li> </ul> <a name="readFileToString-java.io.File-java.nio.charset.Charset-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>readFileToString</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> readFileToString(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html?is-external=true" title="class or interface in java.nio.charset">Charset</a> encoding) 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> <div class="block">Reads the contents of a file into a String. The file is always closed.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to read, must not be <code>null</code></dd> <dd><code>encoding</code> - the encoding to use, <code>null</code> means platform default</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>the file contents, never <code>null</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.3</dd> </dl> </li> </ul> <a name="readFileToString-java.io.File-java.lang.String-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>readFileToString</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> readFileToString(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> encoding) 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> <div class="block">Reads the contents of a file into a String. The file is always closed.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to read, must not be <code>null</code></dd> <dd><code>encoding</code> - the encoding to use, <code>null</code> means platform default</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>the file contents, never <code>null</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/nio/charset/UnsupportedCharsetException.html?is-external=true" title="class or interface in java.nio.charset">UnsupportedCharsetException</a></code> - thrown instead of <a href="http://docs.oracle.com/javase/7/docs/api/java/io/package-summary.html?is-external=true"><code>.UnsupportedEncodingException</code></a> in version 2.2 if the encoding is not supported.</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.3</dd> </dl> </li> </ul> <a name="readFileToString-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>readFileToString</h4> <pre><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a> public static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> readFileToString(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file) 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> <div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">2.5 use <a href="../../../../org/apache/commons/io/FileUtils.html#readFileToString-java.io.File-java.nio.charset.Charset-"><code>readFileToString(File, Charset)</code></a> instead (and specify the appropriate encoding)</span></div> <div class="block">Reads the contents of a file into a String using the default encoding for the VM. The file is always closed.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to read, must not be <code>null</code></dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>the file contents, never <code>null</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.3.1</dd> </dl> </li> </ul> <a name="readFileToByteArray-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>readFileToByteArray</h4> <pre>public static byte[] readFileToByteArray(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file) 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> <div class="block">Reads the contents of a file into a byte array. The file is always closed.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to read, must not be <code>null</code></dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>the file contents, never <code>null</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.1</dd> </dl> </li> </ul> <a name="readLines-java.io.File-java.nio.charset.Charset-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>readLines</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>> readLines(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html?is-external=true" title="class or interface in java.nio.charset">Charset</a> encoding) 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> <div class="block">Reads the contents of a file line by line to a List of Strings. The file is always closed.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to read, must not be <code>null</code></dd> <dd><code>encoding</code> - the encoding to use, <code>null</code> means platform default</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>the list of Strings representing each line in the file, never <code>null</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.3</dd> </dl> </li> </ul> <a name="readLines-java.io.File-java.lang.String-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>readLines</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>> readLines(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> encoding) 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> <div class="block">Reads the contents of a file line by line to a List of Strings. The file is always closed.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to read, must not be <code>null</code></dd> <dd><code>encoding</code> - the encoding to use, <code>null</code> means platform default</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>the list of Strings representing each line in the file, never <code>null</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/nio/charset/UnsupportedCharsetException.html?is-external=true" title="class or interface in java.nio.charset">UnsupportedCharsetException</a></code> - thrown instead of <a href="http://docs.oracle.com/javase/7/docs/api/java/io/package-summary.html?is-external=true"><code>.UnsupportedEncodingException</code></a> in version 2.2 if the encoding is not supported.</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.1</dd> </dl> </li> </ul> <a name="readLines-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>readLines</h4> <pre><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a> public static <a href="http://docs.oracle.com/javase/7/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>> readLines(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file) 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> <div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">2.5 use <a href="../../../../org/apache/commons/io/FileUtils.html#readLines-java.io.File-java.nio.charset.Charset-"><code>readLines(File, Charset)</code></a> instead (and specify the appropriate encoding)</span></div> <div class="block">Reads the contents of a file line by line to a List of Strings using the default encoding for the VM. The file is always closed.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to read, must not be <code>null</code></dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>the list of Strings representing each line in the file, never <code>null</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.3</dd> </dl> </li> </ul> <a name="lineIterator-java.io.File-java.lang.String-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>lineIterator</h4> <pre>public static <a href="../../../../org/apache/commons/io/LineIterator.html" title="class in org.apache.commons.io">LineIterator</a> lineIterator(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> encoding) 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> <div class="block">Returns an Iterator for the lines in a <code>File</code>. <p> This method opens an <code>InputStream</code> for the file. When you have finished with the iterator you should close the stream to free internal resources. This can be done by calling the <a href="../../../../org/apache/commons/io/LineIterator.html#close--"><code>LineIterator.close()</code></a> or <a href="../../../../org/apache/commons/io/LineIterator.html#closeQuietly-org.apache.commons.io.LineIterator-"><code>LineIterator.closeQuietly(LineIterator)</code></a> method. <p> The recommended usage pattern is: <pre> LineIterator it = FileUtils.lineIterator(file, "UTF-8"); try { while (it.hasNext()) { String line = it.nextLine(); /// do something with line } } finally { LineIterator.closeQuietly(iterator); } </pre> <p> If an exception occurs during the creation of the iterator, the underlying stream is closed.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to open for input, must not be <code>null</code></dd> <dd><code>encoding</code> - the encoding to use, <code>null</code> means platform default</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>an Iterator of the lines in the file, never <code>null</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error (file closed)</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.2</dd> </dl> </li> </ul> <a name="lineIterator-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>lineIterator</h4> <pre>public static <a href="../../../../org/apache/commons/io/LineIterator.html" title="class in org.apache.commons.io">LineIterator</a> lineIterator(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file) 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> <div class="block">Returns an Iterator for the lines in a <code>File</code> using the default encoding for the VM.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to open for input, must not be <code>null</code></dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>an Iterator of the lines in the file, never <code>null</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error (file closed)</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.3</dd> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../../../../org/apache/commons/io/FileUtils.html#lineIterator-java.io.File-java.lang.String-"><code>lineIterator(File, String)</code></a></dd> </dl> </li> </ul> <a name="writeStringToFile-java.io.File-java.lang.String-java.nio.charset.Charset-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>writeStringToFile</h4> <pre>public static void writeStringToFile(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> data, <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html?is-external=true" title="class or interface in java.nio.charset">Charset</a> encoding) 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> <div class="block">Writes a String to a file creating the file if it does not exist. <p> NOTE: As from v1.3, the parent directories of the file will be created if they do not exist.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to write</dd> <dd><code>data</code> - the content to write to the file</dd> <dd><code>encoding</code> - the encoding to use, <code>null</code> means platform default</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/UnsupportedEncodingException.html?is-external=true" title="class or interface in java.io">UnsupportedEncodingException</a></code> - if the encoding is not supported by the VM</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.4</dd> </dl> </li> </ul> <a name="writeStringToFile-java.io.File-java.lang.String-java.lang.String-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>writeStringToFile</h4> <pre>public static void writeStringToFile(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> data, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> encoding) 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> <div class="block">Writes a String to a file creating the file if it does not exist. <p> NOTE: As from v1.3, the parent directories of the file will be created if they do not exist.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to write</dd> <dd><code>data</code> - the content to write to the file</dd> <dd><code>encoding</code> - the encoding to use, <code>null</code> means platform default</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/UnsupportedEncodingException.html?is-external=true" title="class or interface in java.io">UnsupportedEncodingException</a></code> - if the encoding is not supported by the VM</dd> </dl> </li> </ul> <a name="writeStringToFile-java.io.File-java.lang.String-java.nio.charset.Charset-boolean-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>writeStringToFile</h4> <pre>public static void writeStringToFile(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> data, <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html?is-external=true" title="class or interface in java.nio.charset">Charset</a> encoding, boolean append) 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> <div class="block">Writes a String to a file creating the file if it does not exist.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to write</dd> <dd><code>data</code> - the content to write to the file</dd> <dd><code>encoding</code> - the encoding to use, <code>null</code> means platform default</dd> <dd><code>append</code> - if <code>true</code>, then the String will be added to the end of the file rather than overwriting</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.3</dd> </dl> </li> </ul> <a name="writeStringToFile-java.io.File-java.lang.String-java.lang.String-boolean-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>writeStringToFile</h4> <pre>public static void writeStringToFile(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> data, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> encoding, boolean append) 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> <div class="block">Writes a String to a file creating the file if it does not exist.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to write</dd> <dd><code>data</code> - the content to write to the file</dd> <dd><code>encoding</code> - the encoding to use, <code>null</code> means platform default</dd> <dd><code>append</code> - if <code>true</code>, then the String will be added to the end of the file rather than overwriting</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/nio/charset/UnsupportedCharsetException.html?is-external=true" title="class or interface in java.nio.charset">UnsupportedCharsetException</a></code> - thrown instead of <a href="http://docs.oracle.com/javase/7/docs/api/java/io/package-summary.html?is-external=true"><code>.UnsupportedEncodingException</code></a> in version 2.2 if the encoding is not supported by the VM</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.1</dd> </dl> </li> </ul> <a name="writeStringToFile-java.io.File-java.lang.String-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>writeStringToFile</h4> <pre><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a> public static void writeStringToFile(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> data) 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> <div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">2.5 use <a href="../../../../org/apache/commons/io/FileUtils.html#writeStringToFile-java.io.File-java.lang.String-java.nio.charset.Charset-"><code>writeStringToFile(File, String, Charset)</code></a> instead (and specify the appropriate encoding)</span></div> <div class="block">Writes a String to a file creating the file if it does not exist using the default encoding for the VM.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to write</dd> <dd><code>data</code> - the content to write to the file</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> </dl> </li> </ul> <a name="writeStringToFile-java.io.File-java.lang.String-boolean-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>writeStringToFile</h4> <pre><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a> public static void writeStringToFile(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> data, boolean append) 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> <div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">2.5 use <a href="../../../../org/apache/commons/io/FileUtils.html#writeStringToFile-java.io.File-java.lang.String-java.nio.charset.Charset-boolean-"><code>writeStringToFile(File, String, Charset, boolean)</code></a> instead (and specify the appropriate encoding)</span></div> <div class="block">Writes a String to a file creating the file if it does not exist using the default encoding for the VM.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to write</dd> <dd><code>data</code> - the content to write to the file</dd> <dd><code>append</code> - if <code>true</code>, then the String will be added to the end of the file rather than overwriting</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.1</dd> </dl> </li> </ul> <a name="write-java.io.File-java.lang.CharSequence-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>write</h4> <pre><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a> public static void write(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</a> data) 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> <div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">2.5 use <a href="../../../../org/apache/commons/io/FileUtils.html#write-java.io.File-java.lang.CharSequence-java.nio.charset.Charset-"><code>write(File, CharSequence, Charset)</code></a> instead (and specify the appropriate encoding)</span></div> <div class="block">Writes a CharSequence to a file creating the file if it does not exist using the default encoding for the VM.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to write</dd> <dd><code>data</code> - the content to write to the file</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.0</dd> </dl> </li> </ul> <a name="write-java.io.File-java.lang.CharSequence-boolean-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>write</h4> <pre><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a> public static void write(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</a> data, boolean append) 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> <div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">2.5 use <a href="../../../../org/apache/commons/io/FileUtils.html#write-java.io.File-java.lang.CharSequence-java.nio.charset.Charset-boolean-"><code>write(File, CharSequence, Charset, boolean)</code></a> instead (and specify the appropriate encoding)</span></div> <div class="block">Writes a CharSequence to a file creating the file if it does not exist using the default encoding for the VM.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to write</dd> <dd><code>data</code> - the content to write to the file</dd> <dd><code>append</code> - if <code>true</code>, then the data will be added to the end of the file rather than overwriting</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.1</dd> </dl> </li> </ul> <a name="write-java.io.File-java.lang.CharSequence-java.nio.charset.Charset-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>write</h4> <pre>public static void write(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</a> data, <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html?is-external=true" title="class or interface in java.nio.charset">Charset</a> encoding) 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> <div class="block">Writes a CharSequence to a file creating the file if it does not exist.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to write</dd> <dd><code>data</code> - the content to write to the file</dd> <dd><code>encoding</code> - the encoding to use, <code>null</code> means platform default</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.3</dd> </dl> </li> </ul> <a name="write-java.io.File-java.lang.CharSequence-java.lang.String-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>write</h4> <pre>public static void write(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</a> data, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> encoding) 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> <div class="block">Writes a CharSequence to a file creating the file if it does not exist.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to write</dd> <dd><code>data</code> - the content to write to the file</dd> <dd><code>encoding</code> - the encoding to use, <code>null</code> means platform default</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/UnsupportedEncodingException.html?is-external=true" title="class or interface in java.io">UnsupportedEncodingException</a></code> - if the encoding is not supported by the VM</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.0</dd> </dl> </li> </ul> <a name="write-java.io.File-java.lang.CharSequence-java.nio.charset.Charset-boolean-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>write</h4> <pre>public static void write(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</a> data, <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html?is-external=true" title="class or interface in java.nio.charset">Charset</a> encoding, boolean append) 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> <div class="block">Writes a CharSequence to a file creating the file if it does not exist.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to write</dd> <dd><code>data</code> - the content to write to the file</dd> <dd><code>encoding</code> - the encoding to use, <code>null</code> means platform default</dd> <dd><code>append</code> - if <code>true</code>, then the data will be added to the end of the file rather than overwriting</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.3</dd> </dl> </li> </ul> <a name="write-java.io.File-java.lang.CharSequence-java.lang.String-boolean-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>write</h4> <pre>public static void write(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</a> data, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> encoding, boolean append) 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> <div class="block">Writes a CharSequence to a file creating the file if it does not exist.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to write</dd> <dd><code>data</code> - the content to write to the file</dd> <dd><code>encoding</code> - the encoding to use, <code>null</code> means platform default</dd> <dd><code>append</code> - if <code>true</code>, then the data will be added to the end of the file rather than overwriting</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/nio/charset/UnsupportedCharsetException.html?is-external=true" title="class or interface in java.nio.charset">UnsupportedCharsetException</a></code> - thrown instead of <a href="http://docs.oracle.com/javase/7/docs/api/java/io/package-summary.html?is-external=true"><code>.UnsupportedEncodingException</code></a> in version 2.2 if the encoding is not supported by the VM</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.1</dd> </dl> </li> </ul> <a name="writeByteArrayToFile-java.io.File-byte:A-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>writeByteArrayToFile</h4> <pre>public static void writeByteArrayToFile(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, byte[] data) 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> <div class="block">Writes a byte array to a file creating the file if it does not exist. <p> NOTE: As from v1.3, the parent directories of the file will be created if they do not exist.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to write to</dd> <dd><code>data</code> - the content to write to the file</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.1</dd> </dl> </li> </ul> <a name="writeByteArrayToFile-java.io.File-byte:A-boolean-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>writeByteArrayToFile</h4> <pre>public static void writeByteArrayToFile(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, byte[] data, boolean append) 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> <div class="block">Writes a byte array to a file creating the file if it does not exist.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to write to</dd> <dd><code>data</code> - the content to write to the file</dd> <dd><code>append</code> - if <code>true</code>, then bytes will be added to the end of the file rather than overwriting</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.1</dd> </dl> </li> </ul> <a name="writeByteArrayToFile-java.io.File-byte:A-int-int-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>writeByteArrayToFile</h4> <pre>public static void writeByteArrayToFile(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, byte[] data, int off, int len) 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> <div class="block">Writes <code>len</code> bytes from the specified byte array starting at offset <code>off</code> to a file, creating the file if it does not exist.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to write to</dd> <dd><code>data</code> - the content to write to the file</dd> <dd><code>off</code> - the start offset in the data</dd> <dd><code>len</code> - the number of bytes to write</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.5</dd> </dl> </li> </ul> <a name="writeByteArrayToFile-java.io.File-byte:A-int-int-boolean-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>writeByteArrayToFile</h4> <pre>public static void writeByteArrayToFile(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, byte[] data, int off, int len, boolean append) 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> <div class="block">Writes <code>len</code> bytes from the specified byte array starting at offset <code>off</code> to a file, creating the file if it does not exist.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to write to</dd> <dd><code>data</code> - the content to write to the file</dd> <dd><code>off</code> - the start offset in the data</dd> <dd><code>len</code> - the number of bytes to write</dd> <dd><code>append</code> - if <code>true</code>, then bytes will be added to the end of the file rather than overwriting</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.5</dd> </dl> </li> </ul> <a name="writeLines-java.io.File-java.lang.String-java.util.Collection-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>writeLines</h4> <pre>public static void writeLines(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> encoding, <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><?> lines) 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> <div class="block">Writes the <code>toString()</code> value of each item in a collection to the specified <code>File</code> line by line. The specified character encoding and the default line ending will be used. <p> NOTE: As from v1.3, the parent directories of the file will be created if they do not exist.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to write to</dd> <dd><code>encoding</code> - the encoding to use, <code>null</code> means platform default</dd> <dd><code>lines</code> - the lines to write, <code>null</code> entries produce blank lines</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/UnsupportedEncodingException.html?is-external=true" title="class or interface in java.io">UnsupportedEncodingException</a></code> - if the encoding is not supported by the VM</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.1</dd> </dl> </li> </ul> <a name="writeLines-java.io.File-java.lang.String-java.util.Collection-boolean-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>writeLines</h4> <pre>public static void writeLines(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> encoding, <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><?> lines, boolean append) 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> <div class="block">Writes the <code>toString()</code> value of each item in a collection to the specified <code>File</code> line by line, optionally appending. The specified character encoding and the default line ending will be used.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to write to</dd> <dd><code>encoding</code> - the encoding to use, <code>null</code> means platform default</dd> <dd><code>lines</code> - the lines to write, <code>null</code> entries produce blank lines</dd> <dd><code>append</code> - if <code>true</code>, then the lines will be added to the end of the file rather than overwriting</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/UnsupportedEncodingException.html?is-external=true" title="class or interface in java.io">UnsupportedEncodingException</a></code> - if the encoding is not supported by the VM</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.1</dd> </dl> </li> </ul> <a name="writeLines-java.io.File-java.util.Collection-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>writeLines</h4> <pre>public static void writeLines(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><?> lines) 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> <div class="block">Writes the <code>toString()</code> value of each item in a collection to the specified <code>File</code> line by line. The default VM encoding and the default line ending will be used.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to write to</dd> <dd><code>lines</code> - the lines to write, <code>null</code> entries produce blank lines</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.3</dd> </dl> </li> </ul> <a name="writeLines-java.io.File-java.util.Collection-boolean-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>writeLines</h4> <pre>public static void writeLines(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><?> lines, boolean append) 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> <div class="block">Writes the <code>toString()</code> value of each item in a collection to the specified <code>File</code> line by line. The default VM encoding and the default line ending will be used.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to write to</dd> <dd><code>lines</code> - the lines to write, <code>null</code> entries produce blank lines</dd> <dd><code>append</code> - if <code>true</code>, then the lines will be added to the end of the file rather than overwriting</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.1</dd> </dl> </li> </ul> <a name="writeLines-java.io.File-java.lang.String-java.util.Collection-java.lang.String-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>writeLines</h4> <pre>public static void writeLines(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> encoding, <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><?> lines, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> lineEnding) 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> <div class="block">Writes the <code>toString()</code> value of each item in a collection to the specified <code>File</code> line by line. The specified character encoding and the line ending will be used. <p> NOTE: As from v1.3, the parent directories of the file will be created if they do not exist.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to write to</dd> <dd><code>encoding</code> - the encoding to use, <code>null</code> means platform default</dd> <dd><code>lines</code> - the lines to write, <code>null</code> entries produce blank lines</dd> <dd><code>lineEnding</code> - the line separator to use, <code>null</code> is system default</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/UnsupportedEncodingException.html?is-external=true" title="class or interface in java.io">UnsupportedEncodingException</a></code> - if the encoding is not supported by the VM</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.1</dd> </dl> </li> </ul> <a name="writeLines-java.io.File-java.lang.String-java.util.Collection-java.lang.String-boolean-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>writeLines</h4> <pre>public static void writeLines(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> encoding, <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><?> lines, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> lineEnding, boolean append) 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> <div class="block">Writes the <code>toString()</code> value of each item in a collection to the specified <code>File</code> line by line. The specified character encoding and the line ending will be used.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to write to</dd> <dd><code>encoding</code> - the encoding to use, <code>null</code> means platform default</dd> <dd><code>lines</code> - the lines to write, <code>null</code> entries produce blank lines</dd> <dd><code>lineEnding</code> - the line separator to use, <code>null</code> is system default</dd> <dd><code>append</code> - if <code>true</code>, then the lines will be added to the end of the file rather than overwriting</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/UnsupportedEncodingException.html?is-external=true" title="class or interface in java.io">UnsupportedEncodingException</a></code> - if the encoding is not supported by the VM</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.1</dd> </dl> </li> </ul> <a name="writeLines-java.io.File-java.util.Collection-java.lang.String-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>writeLines</h4> <pre>public static void writeLines(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><?> lines, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> lineEnding) 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> <div class="block">Writes the <code>toString()</code> value of each item in a collection to the specified <code>File</code> line by line. The default VM encoding and the specified line ending will be used.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to write to</dd> <dd><code>lines</code> - the lines to write, <code>null</code> entries produce blank lines</dd> <dd><code>lineEnding</code> - the line separator to use, <code>null</code> is system default</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.3</dd> </dl> </li> </ul> <a name="writeLines-java.io.File-java.util.Collection-java.lang.String-boolean-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>writeLines</h4> <pre>public static void writeLines(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><?> lines, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> lineEnding, boolean append) 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> <div class="block">Writes the <code>toString()</code> value of each item in a collection to the specified <code>File</code> line by line. The default VM encoding and the specified line ending will be used.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to write to</dd> <dd><code>lines</code> - the lines to write, <code>null</code> entries produce blank lines</dd> <dd><code>lineEnding</code> - the line separator to use, <code>null</code> is system default</dd> <dd><code>append</code> - if <code>true</code>, then the lines will be added to the end of the file rather than overwriting</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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> - in case of an I/O error</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.1</dd> </dl> </li> </ul> <a name="forceDelete-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>forceDelete</h4> <pre>public static void forceDelete(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file) 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> <div class="block">Deletes a file. If file is a directory, delete it and all sub-directories. <p> The difference between File.delete() and this method are: <ul> <li>A directory to be deleted does not have to be empty.</li> <li>You get exceptions when a file or directory cannot be deleted. (java.io.File methods returns a boolean)</li> </ul></div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - file or directory to delete, must not be <code>null</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 directory is <code>null</code></dd> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/FileNotFoundException.html?is-external=true" title="class or interface in java.io">FileNotFoundException</a></code> - if the file was not found</dd> <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> - in case deletion is unsuccessful</dd> </dl> </li> </ul> <a name="forceDeleteOnExit-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>forceDeleteOnExit</h4> <pre>public static void forceDeleteOnExit(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file) 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> <div class="block">Schedules a file to be deleted when JVM exits. If file is directory delete it and all sub-directories.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - file or directory to delete, must not be <code>null</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 file is <code>null</code></dd> <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> - in case deletion is unsuccessful</dd> </dl> </li> </ul> <a name="forceMkdir-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>forceMkdir</h4> <pre>public static void forceMkdir(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> directory) 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> <div class="block">Makes a directory, including any necessary but nonexistent parent directories. If a file already exists with specified name but it is not a directory then an IOException is thrown. If the directory cannot be created (or does not already exist) then an IOException is thrown.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>directory</code> - directory to create, must not be <code>null</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 directory is <code>null</code></dd> <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 the directory cannot be created or the file already exists but is not a directory</dd> </dl> </li> </ul> <a name="forceMkdirParent-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>forceMkdirParent</h4> <pre>public static void forceMkdirParent(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file) 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> <div class="block">Makes any necessary but nonexistent parent directories for a given File. If the parent directory cannot be created then an IOException is thrown.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - file with parent to create, must not be <code>null</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 file is <code>null</code></dd> <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 the parent directory cannot be created</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.5</dd> </dl> </li> </ul> <a name="sizeOf-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>sizeOf</h4> <pre>public static long sizeOf(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file)</pre> <div class="block">Returns the size of the specified file or directory. If the provided <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io"><code>File</code></a> is a regular file, then the file's length is returned. If the argument is a directory, then the size of the directory is calculated recursively. If a directory or subdirectory is security restricted, its size will not be included. <p> Note that overflow is not detected, and the return value may be negative if overflow occurs. See <a href="../../../../org/apache/commons/io/FileUtils.html#sizeOfAsBigInteger-java.io.File-"><code>sizeOfAsBigInteger(File)</code></a> for an alternative method that does not overflow.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the regular file or directory to return the size of (must not be <code>null</code>).</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>the length of the file, or recursive size of the directory, provided (in bytes).</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 file is <code>null</code></dd> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the file does not exist.</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.0</dd> </dl> </li> </ul> <a name="sizeOfAsBigInteger-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>sizeOfAsBigInteger</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a> sizeOfAsBigInteger(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file)</pre> <div class="block">Returns the size of the specified file or directory. If the provided <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io"><code>File</code></a> is a regular file, then the file's length is returned. If the argument is a directory, then the size of the directory is calculated recursively. If a directory or subdirectory is security restricted, its size will not be included.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the regular file or directory to return the size of (must not be <code>null</code>).</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>the length of the file, or recursive size of the directory, provided (in bytes).</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 file is <code>null</code></dd> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the file does not exist.</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.4</dd> </dl> </li> </ul> <a name="sizeOfDirectory-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>sizeOfDirectory</h4> <pre>public static long sizeOfDirectory(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> directory)</pre> <div class="block">Counts the size of a directory recursively (sum of the length of all files). <p> Note that overflow is not detected, and the return value may be negative if overflow occurs. See <a href="../../../../org/apache/commons/io/FileUtils.html#sizeOfDirectoryAsBigInteger-java.io.File-"><code>sizeOfDirectoryAsBigInteger(File)</code></a> for an alternative method that does not overflow.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>directory</code> - directory to inspect, must not be <code>null</code></dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>size of directory in bytes, 0 if directory is security restricted, a negative number when the real total is greater than <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Long.html?is-external=true#MAX_VALUE" title="class or interface in java.lang"><code>Long.MAX_VALUE</code></a>.</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 directory is <code>null</code></dd> </dl> </li> </ul> <a name="sizeOfDirectoryAsBigInteger-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>sizeOfDirectoryAsBigInteger</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a> sizeOfDirectoryAsBigInteger(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> directory)</pre> <div class="block">Counts the size of a directory recursively (sum of the length of all files).</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>directory</code> - directory to inspect, must not be <code>null</code></dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>size of directory in bytes, 0 if directory is security restricted.</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 directory is <code>null</code></dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.4</dd> </dl> </li> </ul> <a name="isFileNewer-java.io.File-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>isFileNewer</h4> <pre>public static boolean isFileNewer(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> reference)</pre> <div class="block">Tests if the specified <code>File</code> is newer than the reference <code>File</code>.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the <code>File</code> of which the modification date must be compared, must not be <code>null</code></dd> <dd><code>reference</code> - the <code>File</code> of which the modification date is used, must not be <code>null</code></dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>true if the <code>File</code> exists and has been modified more recently than the reference <code>File</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the file is <code>null</code></dd> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the reference file is <code>null</code> or doesn't exist</dd> </dl> </li> </ul> <a name="isFileNewer-java.io.File-java.util.Date-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>isFileNewer</h4> <pre>public static boolean isFileNewer(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Date.html?is-external=true" title="class or interface in java.util">Date</a> date)</pre> <div class="block">Tests if the specified <code>File</code> is newer than the specified <code>Date</code>.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the <code>File</code> of which the modification date must be compared, must not be <code>null</code></dd> <dd><code>date</code> - the date reference, must not be <code>null</code></dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>true if the <code>File</code> exists and has been modified after the given <code>Date</code>.</dd> <dt><span class="throwsLabel">Throws:</span></dt> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the file is <code>null</code></dd> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the date is <code>null</code></dd> </dl> </li> </ul> <a name="isFileNewer-java.io.File-long-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>isFileNewer</h4> <pre>public static boolean isFileNewer(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, long timeMillis)</pre> <div class="block">Tests if the specified <code>File</code> is newer than the specified time reference.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the <code>File</code> of which the modification date must be compared, must not be <code>null</code></dd> <dd><code>timeMillis</code> - the time reference measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970)</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>true if the <code>File</code> exists and has been modified after the given time reference.</dd> <dt><span class="throwsLabel">Throws:</span></dt> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the file is <code>null</code></dd> </dl> </li> </ul> <a name="isFileOlder-java.io.File-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>isFileOlder</h4> <pre>public static boolean isFileOlder(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> reference)</pre> <div class="block">Tests if the specified <code>File</code> is older than the reference <code>File</code>.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the <code>File</code> of which the modification date must be compared, must not be <code>null</code></dd> <dd><code>reference</code> - the <code>File</code> of which the modification date is used, must not be <code>null</code></dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>true if the <code>File</code> exists and has been modified before the reference <code>File</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the file is <code>null</code></dd> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the reference file is <code>null</code> or doesn't exist</dd> </dl> </li> </ul> <a name="isFileOlder-java.io.File-java.util.Date-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>isFileOlder</h4> <pre>public static boolean isFileOlder(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Date.html?is-external=true" title="class or interface in java.util">Date</a> date)</pre> <div class="block">Tests if the specified <code>File</code> is older than the specified <code>Date</code>.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the <code>File</code> of which the modification date must be compared, must not be <code>null</code></dd> <dd><code>date</code> - the date reference, must not be <code>null</code></dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>true if the <code>File</code> exists and has been modified before the given <code>Date</code>.</dd> <dt><span class="throwsLabel">Throws:</span></dt> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the file is <code>null</code></dd> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the date is <code>null</code></dd> </dl> </li> </ul> <a name="isFileOlder-java.io.File-long-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>isFileOlder</h4> <pre>public static boolean isFileOlder(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, long timeMillis)</pre> <div class="block">Tests if the specified <code>File</code> is older than the specified time reference.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the <code>File</code> of which the modification date must be compared, must not be <code>null</code></dd> <dd><code>timeMillis</code> - the time reference measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970)</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>true if the <code>File</code> exists and has been modified before the given time reference.</dd> <dt><span class="throwsLabel">Throws:</span></dt> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the file is <code>null</code></dd> </dl> </li> </ul> <a name="checksumCRC32-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>checksumCRC32</h4> <pre>public static long checksumCRC32(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file) 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> <div class="block">Computes the checksum of a file using the CRC32 checksum routine. The value of the checksum is returned.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to checksum, must not be <code>null</code></dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>the checksum value</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 file or checksum is <code>null</code></dd> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the file is a directory</dd> <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 IO error occurs reading the file</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.3</dd> </dl> </li> </ul> <a name="checksum-java.io.File-java.util.zip.Checksum-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>checksum</h4> <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/util/zip/Checksum.html?is-external=true" title="class or interface in java.util.zip">Checksum</a> checksum(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file, <a href="http://docs.oracle.com/javase/7/docs/api/java/util/zip/Checksum.html?is-external=true" title="class or interface in java.util.zip">Checksum</a> checksum) 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> <div class="block">Computes the checksum of a file using the specified checksum object. Multiple files may be checked using one <code>Checksum</code> instance if desired simply by reusing the same checksum object. For example: <pre> long csum = FileUtils.checksum(file, new CRC32()).getValue(); </pre></div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to checksum, must not be <code>null</code></dd> <dd><code>checksum</code> - the checksum object to be used, must not be <code>null</code></dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>the checksum specified, updated with the content of the file</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 file or checksum is <code>null</code></dd> <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the file is a directory</dd> <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 IO error occurs reading the file</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.3</dd> </dl> </li> </ul> <a name="moveDirectory-java.io.File-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>moveDirectory</h4> <pre>public static void moveDirectory(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> srcDir, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destDir) 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> <div class="block">Moves a directory. <p> When the destination directory is on another file system, do a "copy and delete".</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>srcDir</code> - the directory to be moved</dd> <dd><code>destDir</code> - the destination directory</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 source or destination is <code>null</code></dd> <dd><code><a href="../../../../org/apache/commons/io/FileExistsException.html" title="class in org.apache.commons.io">FileExistsException</a></code> - if the destination directory exists</dd> <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 source or destination is invalid</dd> <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 IO error occurs moving the file</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.4</dd> </dl> </li> </ul> <a name="moveDirectoryToDirectory-java.io.File-java.io.File-boolean-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>moveDirectoryToDirectory</h4> <pre>public static void moveDirectoryToDirectory(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> src, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destDir, boolean createDestDir) 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> <div class="block">Moves a directory to another directory.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>src</code> - the file to be moved</dd> <dd><code>destDir</code> - the destination file</dd> <dd><code>createDestDir</code> - If <code>true</code> create the destination directory, otherwise if <code>false</code> throw an IOException</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 source or destination is <code>null</code></dd> <dd><code><a href="../../../../org/apache/commons/io/FileExistsException.html" title="class in org.apache.commons.io">FileExistsException</a></code> - if the directory exists in the destination directory</dd> <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 source or destination is invalid</dd> <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 IO error occurs moving the file</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.4</dd> </dl> </li> </ul> <a name="moveFile-java.io.File-java.io.File-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>moveFile</h4> <pre>public static void moveFile(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> srcFile, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destFile) 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> <div class="block">Moves a file. <p> When the destination file is on another file system, do a "copy and delete".</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>srcFile</code> - the file to be moved</dd> <dd><code>destFile</code> - the destination file</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 source or destination is <code>null</code></dd> <dd><code><a href="../../../../org/apache/commons/io/FileExistsException.html" title="class in org.apache.commons.io">FileExistsException</a></code> - if the destination file exists</dd> <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 source or destination is invalid</dd> <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 IO error occurs moving the file</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.4</dd> </dl> </li> </ul> <a name="moveFileToDirectory-java.io.File-java.io.File-boolean-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>moveFileToDirectory</h4> <pre>public static void moveFileToDirectory(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> srcFile, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destDir, boolean createDestDir) 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> <div class="block">Moves a file to a directory.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>srcFile</code> - the file to be moved</dd> <dd><code>destDir</code> - the destination file</dd> <dd><code>createDestDir</code> - If <code>true</code> create the destination directory, otherwise if <code>false</code> throw an IOException</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 source or destination is <code>null</code></dd> <dd><code><a href="../../../../org/apache/commons/io/FileExistsException.html" title="class in org.apache.commons.io">FileExistsException</a></code> - if the destination file exists</dd> <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 source or destination is invalid</dd> <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 IO error occurs moving the file</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.4</dd> </dl> </li> </ul> <a name="moveToDirectory-java.io.File-java.io.File-boolean-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>moveToDirectory</h4> <pre>public static void moveToDirectory(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> src, <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> destDir, boolean createDestDir) 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> <div class="block">Moves a file or directory to the destination directory. <p> When the destination is on another file system, do a "copy and delete".</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>src</code> - the file or directory to be moved</dd> <dd><code>destDir</code> - the destination directory</dd> <dd><code>createDestDir</code> - If <code>true</code> create the destination directory, otherwise if <code>false</code> throw an IOException</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 source or destination is <code>null</code></dd> <dd><code><a href="../../../../org/apache/commons/io/FileExistsException.html" title="class in org.apache.commons.io">FileExistsException</a></code> - if the directory or file exists in the destination directory</dd> <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 source or destination is invalid</dd> <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 IO error occurs moving the file</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.4</dd> </dl> </li> </ul> <a name="isSymlink-java.io.File-"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>isSymlink</h4> <pre>public static boolean isSymlink(<a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> file) 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> <div class="block">Determines whether the specified file is a Symbolic Link rather than an actual file. <p> Will not return true if there is a Symbolic Link anywhere in the path, only if the specific file is. <p> When using jdk1.7, this method delegates to <code>boolean java.nio.file.Files.isSymbolicLink(Path path)</code> <b>Note:</b> the current implementation always returns <code>false</code> if running on jkd1.6 and the system is detected as Windows using <a href="../../../../org/apache/commons/io/FilenameUtils.html#isSystemWindows--"><code>FilenameUtils.isSystemWindows()</code></a> <p> For code that runs on Java 1.7 or later, use the following method instead: <br> <code>boolean java.nio.file.Files.isSymbolicLink(Path path)</code></div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>file</code> - the file to check</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>true if the file is a Symbolic Link</dd> <dt><span class="throwsLabel">Throws:</span></dt> <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 IO error occurs while checking the file</dd> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>2.0</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/FileUtils.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/commons/io/FileSystemUtils.html" title="class in org.apache.commons.io"><span class="typeNameLink">Prev Class</span></a></li> <li><a href="../../../../org/apache/commons/io/HexDump.html" title="class in org.apache.commons.io"><span class="typeNameLink">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/apache/commons/io/FileUtils.html" target="_top">Frames</a></li> <li><a href="FileUtils.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 © 2002–2017 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> </body> </html>