FileUtils (Commons IO 2.5)
Date: 2016-12-01

org.apache.commons.io

## Class FileUtils

- java.lang.Object
- - org.apache.commons.io.FileUtils

-     public class FileUtils
      extends java.lang.Object

  General file manipulation utilities.

  Facilities are provided in the following areas:

  - writing to a file
  - reading from a file
  - make a directory including parent directories
  - copying files and directories
  - deleting files and directories
  - converting to and from a URL
  - listing files and directories by filter and extension
  - comparing file content
  - file last changed date
  - calculating a checksum

  Origin of code: Excalibur, Alexandria, Commons-Utils

  Version:
    $Id: FileUtils.java 1722481 2016-01-01 01:42:04Z dbrosius $

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.io.File[]` | `EMPTY_FILE_ARRAY` An empty array of type `File`.
    `private static long` | `FILE_COPY_BUFFER_SIZE` The file copy buffer size (30 MB)
    `static long` | `ONE_EB` The number of bytes in an exabyte.
    `static java.math.BigInteger` | `ONE_EB_BI` The number of bytes in an exabyte.
    `static long` | `ONE_GB` The number of bytes in a gigabyte.
    `static java.math.BigInteger` | `ONE_GB_BI` The number of bytes in a gigabyte.
    `static long` | `ONE_KB` The number of bytes in a kilobyte.
    `static java.math.BigInteger` | `ONE_KB_BI` The number of bytes in a kilobyte.
    `static long` | `ONE_MB` The number of bytes in a megabyte.
    `static java.math.BigInteger` | `ONE_MB_BI` The number of bytes in a megabyte.
    `static long` | `ONE_PB` The number of bytes in a petabyte.
    `static java.math.BigInteger` | `ONE_PB_BI` The number of bytes in a petabyte.
    `static long` | `ONE_TB` The number of bytes in a terabyte.
    `static java.math.BigInteger` | `ONE_TB_BI` The number of bytes in a terabyte.
    `static java.math.BigInteger` | `ONE_YB` The number of bytes in a yottabyte.
    `static java.math.BigInteger` | `ONE_ZB` The number of bytes in a zettabyte.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FileUtils()` Instances should NOT be constructed in standard programming.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.String` | `byteCountToDisplaySize(java.math.BigInteger size)` Returns a human-readable version of the file size, where the input represents a specific number of bytes.
    `static java.lang.String` | `byteCountToDisplaySize(long size)` Returns a human-readable version of the file size, where the input represents a specific number of bytes.
    `private static void` | `checkDirectory(java.io.File directory)` Checks that the given `File` exists and is a directory.
    `private static void` | `checkFileRequirements(java.io.File src, java.io.File dest)` checks requirements for file copy
    `static java.util.zip.Checksum` | `checksum(java.io.File file, java.util.zip.Checksum checksum)` Computes the checksum of a file using the specified checksum object.
    `static long` | `checksumCRC32(java.io.File file)` Computes the checksum of a file using the CRC32 checksum routine.
    `static void` | `cleanDirectory(java.io.File directory)` Cleans a directory without deleting it.
    `private static void` | `cleanDirectoryOnExit(java.io.File directory)` Cleans a directory without deleting it.
    `static boolean` | `contentEquals(java.io.File file1, java.io.File file2)` Compares the contents of two files to determine if they are equal or not.
    `static boolean` | `contentEqualsIgnoreEOL(java.io.File file1, java.io.File file2, java.lang.String charsetName)` Compares the contents of two files to determine if they are equal or not.
    `static java.io.File[]` | `convertFileCollectionToFileArray(java.util.Collection<java.io.File> files)` Converts a Collection containing java.io.File instanced into array representation.
    `static void` | `copyDirectory(java.io.File srcDir, java.io.File destDir)` Copies a whole directory to a new location preserving the file dates.
    `static void` | `copyDirectory(java.io.File srcDir, java.io.File destDir, boolean preserveFileDate)` Copies a whole directory to a new location.
    `static void` | `copyDirectory(java.io.File srcDir, java.io.File destDir, java.io.FileFilter filter)` Copies a filtered directory to a new location preserving the file dates.
    `static void` | `copyDirectory(java.io.File srcDir, java.io.File destDir, java.io.FileFilter filter, boolean preserveFileDate)` Copies a filtered directory to a new location.
    `static void` | `copyDirectoryToDirectory(java.io.File srcDir, java.io.File destDir)` Copies a directory to within another directory preserving the file dates.
    `static void` | `copyFile(java.io.File srcFile, java.io.File destFile)` Copies a file to a new location preserving the file date.
    `static void` | `copyFile(java.io.File srcFile, java.io.File destFile, boolean preserveFileDate)` Copies a file to a new location.
    `static long` | `copyFile(java.io.File input, java.io.OutputStream output)` Copy bytes from a `File` to an `OutputStream`.
    `static void` | `copyFileToDirectory(java.io.File srcFile, java.io.File destDir)` Copies a file to a directory preserving the file date.
    `static void` | `copyFileToDirectory(java.io.File srcFile, java.io.File destDir, boolean preserveFileDate)` Copies a file to a directory optionally preserving the file date.
    `static void` | `copyInputStreamToFile(java.io.InputStream source, java.io.File destination)` Copies bytes from an `InputStream` `source` to a file `destination`.
    `static void` | `copyToFile(java.io.InputStream source, java.io.File destination)` Copies bytes from an `InputStream` `source` to a file `destination`.
    `static void` | `copyURLToFile(java.net.URL source, java.io.File destination)` Copies bytes from the URL `source` to a file `destination`.
    `static void` | `copyURLToFile(java.net.URL source, java.io.File destination, int connectionTimeout, int readTimeout)` Copies bytes from the URL `source` to a file `destination`.
    `(package private) static java.lang.String` | `decodeUrl(java.lang.String url)` Decodes the specified URL as per RFC 3986, i.e.
    `static void` | `deleteDirectory(java.io.File directory)` Deletes a directory recursively.
    `private static void` | `deleteDirectoryOnExit(java.io.File directory)` Schedules a directory recursively for deletion on JVM exit.
    `static boolean` | `deleteQuietly(java.io.File file)` Deletes a file, never throwing an exception.
    `static boolean` | `directoryContains(java.io.File directory, java.io.File child)` Determines whether the `parent` directory contains the `child` element (a file or directory).
    `private static void` | `doCopyDirectory(java.io.File srcDir, java.io.File destDir, java.io.FileFilter filter, boolean preserveFileDate, java.util.List<java.lang.String> exclusionList)` Internal copy directory method.
    `private static void` | `doCopyFile(java.io.File srcFile, java.io.File destFile, boolean preserveFileDate)` Internal copy file method.
    `static void` | `forceDelete(java.io.File file)` Deletes a file.
    `static void` | `forceDeleteOnExit(java.io.File file)` Schedules a file to be deleted when JVM exits.
    `static void` | `forceMkdir(java.io.File directory)` Makes a directory, including any necessary but nonexistent parent directories.
    `static void` | `forceMkdirParent(java.io.File file)` Makes any necessary but nonexistent parent directories for a given File.
    `static java.io.File` | `getFile(java.io.File directory, java.lang.String... names)` Construct a file from the set of name elements.
    `static java.io.File` | `getFile(java.lang.String... names)` Construct a file from the set of name elements.
    `static java.io.File` | `getTempDirectory()` Returns a `File` representing the system temporary directory.
    `static java.lang.String` | `getTempDirectoryPath()` Returns the path to the system temporary directory.
    `static java.io.File` | `getUserDirectory()` Returns a `File` representing the user's home directory.
    `static java.lang.String` | `getUserDirectoryPath()` Returns the path to the user's home directory.
    `private static void` | `innerListFiles(java.util.Collection<java.io.File> files, java.io.File directory, IOFileFilter filter, boolean includeSubDirectories)` Finds files within a given directory (and optionally its subdirectories).
    `private static boolean` | `isBrokenSymlink(java.io.File file)` Determines if the specified file is possibly a broken symbolic link.
    `static boolean` | `isFileNewer(java.io.File file, java.util.Date date)` Tests if the specified `File` is newer than the specified `Date`.
    `static boolean` | `isFileNewer(java.io.File file, java.io.File reference)` Tests if the specified `File` is newer than the reference `File`.
    `static boolean` | `isFileNewer(java.io.File file, long timeMillis)` Tests if the specified `File` is newer than the specified time reference.
    `static boolean` | `isFileOlder(java.io.File file, java.util.Date date)` Tests if the specified `File` is older than the specified `Date`.
    `static boolean` | `isFileOlder(java.io.File file, java.io.File reference)` Tests if the specified `File` is older than the reference `File`.
    `static boolean` | `isFileOlder(java.io.File file, long timeMillis)` Tests if the specified `File` is older than the specified time reference.
    `static boolean` | `isSymlink(java.io.File file)` Determines whether the specified file is a Symbolic Link rather than an actual file.
    `static java.util.Iterator<java.io.File>` | `iterateFiles(java.io.File directory, IOFileFilter fileFilter, IOFileFilter dirFilter)` Allows iteration over the files in given directory (and optionally its subdirectories).
    `static java.util.Iterator<java.io.File>` | `iterateFiles(java.io.File directory, java.lang.String[] extensions, boolean recursive)` Allows iteration over the files in a given directory (and optionally its subdirectories) which match an array of extensions.
    `static java.util.Iterator<java.io.File>` | `iterateFilesAndDirs(java.io.File directory, IOFileFilter fileFilter, IOFileFilter dirFilter)` Allows iteration over the files in given directory (and optionally its subdirectories).
    `static LineIterator` | `lineIterator(java.io.File file)` Returns an Iterator for the lines in a `File` using the default encoding for the VM.
    `static LineIterator` | `lineIterator(java.io.File file, java.lang.String encoding)` Returns an Iterator for the lines in a `File`.
    `static java.util.Collection<java.io.File>` | `listFiles(java.io.File directory, IOFileFilter fileFilter, IOFileFilter dirFilter)` Finds files within a given directory (and optionally its subdirectories).
    `static java.util.Collection<java.io.File>` | `listFiles(java.io.File directory, java.lang.String[] extensions, boolean recursive)` Finds files within a given directory (and optionally its subdirectories) which match an array of extensions.
    `static java.util.Collection<java.io.File>` | `listFilesAndDirs(java.io.File directory, IOFileFilter fileFilter, IOFileFilter dirFilter)` Finds files within a given directory (and optionally its subdirectories).
    `static void` | `moveDirectory(java.io.File srcDir, java.io.File destDir)` Moves a directory.
    `static void` | `moveDirectoryToDirectory(java.io.File src, java.io.File destDir, boolean createDestDir)` Moves a directory to another directory.
    `static void` | `moveFile(java.io.File srcFile, java.io.File destFile)` Moves a file.
    `static void` | `moveFileToDirectory(java.io.File srcFile, java.io.File destDir, boolean createDestDir)` Moves a file to a directory.
    `static void` | `moveToDirectory(java.io.File src, java.io.File destDir, boolean createDestDir)` Moves a file or directory to the destination directory.
    `static java.io.FileInputStream` | `openInputStream(java.io.File file)` Opens a `FileInputStream` for the specified file, providing better error messages than simply calling `new FileInputStream(file)`.
    `static java.io.FileOutputStream` | `openOutputStream(java.io.File file)` Opens a `FileOutputStream` for the specified file, checking and creating the parent directory if it does not exist.
    `static java.io.FileOutputStream` | `openOutputStream(java.io.File file, boolean append)` Opens a `FileOutputStream` for the specified file, checking and creating the parent directory if it does not exist.
    `static byte[]` | `readFileToByteArray(java.io.File file)` Reads the contents of a file into a byte array.
    `static java.lang.String` | `readFileToString(java.io.File file)` Deprecated. 2.5 use `readFileToString(File, Charset)` instead
    `static java.lang.String` | `readFileToString(java.io.File file, java.nio.charset.Charset encoding)` Reads the contents of a file into a String.
    `static java.lang.String` | `readFileToString(java.io.File file, java.lang.String encoding)` Reads the contents of a file into a String.
    `static java.util.List<java.lang.String>` | `readLines(java.io.File file)` Deprecated. 2.5 use `readLines(File, Charset)` instead
    `static java.util.List<java.lang.String>` | `readLines(java.io.File file, java.nio.charset.Charset encoding)` Reads the contents of a file line by line to a List of Strings.
    `static java.util.List<java.lang.String>` | `readLines(java.io.File file, java.lang.String encoding)` Reads the contents of a file line by line to a List of Strings.
    `private static IOFileFilter` | `setUpEffectiveDirFilter(IOFileFilter dirFilter)` Returns a filter that accepts directories in addition to the `File` objects accepted by the given filter.
    `private static IOFileFilter` | `setUpEffectiveFileFilter(IOFileFilter fileFilter)` Returns a filter that accepts files in addition to the `File` objects accepted by the given filter.
    `static long` | `sizeOf(java.io.File file)` Returns the size of the specified file or directory.
    `private static long` | `sizeOf0(java.io.File file)` the size of a file
    `static java.math.BigInteger` | `sizeOfAsBigInteger(java.io.File file)` Returns the size of the specified file or directory.
    `private static java.math.BigInteger` | `sizeOfBig0(java.io.File fileOrDir)` Returns the sid of a file
    `static long` | `sizeOfDirectory(java.io.File directory)` Counts the size of a directory recursively (sum of the length of all files).
    `private static long` | `sizeOfDirectory0(java.io.File directory)` the size of a director
    `static java.math.BigInteger` | `sizeOfDirectoryAsBigInteger(java.io.File directory)` Counts the size of a directory recursively (sum of the length of all files).
    `private static java.math.BigInteger` | `sizeOfDirectoryBig0(java.io.File directory)` Finds the size of a directory
    `static java.io.File` | `toFile(java.net.URL url)` Convert from a `URL` to a `File`.
    `static java.io.File[]` | `toFiles(java.net.URL[] urls)` Converts each of an array of `URL` to a `File`.
    `private static java.lang.String[]` | `toSuffixes(java.lang.String[] extensions)` Converts an array of file extensions to suffixes for use with IOFileFilters.
    `static void` | `touch(java.io.File file)` Implements the same behaviour as the "touch" utility on Unix.
    `static java.net.URL[]` | `toURLs(java.io.File[] files)` Converts each of an array of `File` to a `URL`.
    `private static void` | `validateListFilesParameters(java.io.File directory, IOFileFilter fileFilter)` Validates the given arguments.
    `private static java.io.File[]` | `verifiedListFiles(java.io.File directory)` Lists files in a directory, asserting that the supplied directory satisfies exists and is a directory
    `static boolean` | `waitFor(java.io.File file, int seconds)` Waits for NFS to propagate a file creation, imposing a timeout.
    `static void` | `write(java.io.File file, java.lang.CharSequence data)` Deprecated. 2.5 use `write(File, CharSequence, Charset)` instead
    `static void` | `write(java.io.File file, java.lang.CharSequence data, boolean append)` Deprecated. 2.5 use `write(File, CharSequence, Charset, boolean)` instead
    `static void` | `write(java.io.File file, java.lang.CharSequence data, java.nio.charset.Charset encoding)` Writes a CharSequence to a file creating the file if it does not exist.
    `static void` | `write(java.io.File file, java.lang.CharSequence data, java.nio.charset.Charset encoding, boolean append)` Writes a CharSequence to a file creating the file if it does not exist.
    `static void` | `write(java.io.File file, java.lang.CharSequence data, java.lang.String encoding)` Writes a CharSequence to a file creating the file if it does not exist.
    `static void` | `write(java.io.File file, java.lang.CharSequence data, java.lang.String encoding, boolean append)` Writes a CharSequence to a file creating the file if it does not exist.
    `static void` | `writeByteArrayToFile(java.io.File file, byte[] data)` Writes a byte array to a file creating the file if it does not exist.
    `static void` | `writeByteArrayToFile(java.io.File file, byte[] data, boolean append)` Writes a byte array to a file creating the file if it does not exist.
    `static void` | `writeByteArrayToFile(java.io.File file, byte[] data, int off, int len)` Writes `len` bytes from the specified byte array starting at offset `off` to a file, creating the file if it does not exist.
    `static void` | `writeByteArrayToFile(java.io.File file, byte[] data, int off, int len, boolean append)` Writes `len` bytes from the specified byte array starting at offset `off` to a file, creating the file if it does not exist.
    `static void` | `writeLines(java.io.File file, java.util.Collection<?> lines)` Writes the `toString()` value of each item in a collection to the specified `File` line by line.
    `static void` | `writeLines(java.io.File file, java.util.Collection<?> lines, boolean append)` Writes the `toString()` value of each item in a collection to the specified `File` line by line.
    `static void` | `writeLines(java.io.File file, java.util.Collection<?> lines, java.lang.String lineEnding)` Writes the `toString()` value of each item in a collection to the specified `File` line by line.
    `static void` | `writeLines(java.io.File file, java.util.Collection<?> lines, java.lang.String lineEnding, boolean append)` Writes the `toString()` value of each item in a collection to the specified `File` line by line.
    `static void` | `writeLines(java.io.File file, java.lang.String encoding, java.util.Collection<?> lines)` Writes the `toString()` value of each item in a collection to the specified `File` line by line.
    `static void` | `writeLines(java.io.File file, java.lang.String encoding, java.util.Collection<?> lines, boolean append)` Writes the `toString()` value of each item in a collection to the specified `File` line by line, optionally appending.
    `static void` | `writeLines(java.io.File file, java.lang.String encoding, java.util.Collection<?> lines, java.lang.String lineEnding)` Writes the `toString()` value of each item in a collection to the specified `File` line by line.
    `static void` | `writeLines(java.io.File file, java.lang.String encoding, java.util.Collection<?> lines, java.lang.String lineEnding, boolean append)` Writes the `toString()` value of each item in a collection to the specified `File` line by line.
    `static void` | `writeStringToFile(java.io.File file, java.lang.String data)` Deprecated. 2.5 use `writeStringToFile(File, String, Charset)` instead
    `static void` | `writeStringToFile(java.io.File file, java.lang.String data, boolean append)` Deprecated. 2.5 use `writeStringToFile(File, String, Charset, boolean)` instead
    `static void` | `writeStringToFile(java.io.File file, java.lang.String data, java.nio.charset.Charset encoding)` Writes a String to a file creating the file if it does not exist.
    `static void` | `writeStringToFile(java.io.File file, java.lang.String data, java.nio.charset.Charset encoding, boolean append)` Writes a String to a file creating the file if it does not exist.
    `static void` | `writeStringToFile(java.io.File file, java.lang.String data, java.lang.String encoding)` Writes a String to a file creating the file if it does not exist.
    `static void` | `writeStringToFile(java.io.File file, java.lang.String data, java.lang.String encoding, boolean append)` Writes a String to a file creating the file if it does not exist.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ONE_KB

          public static final long ONE_KB

      The number of bytes in a kilobyte.
      See Also:
        Constant Field Values

    - #### ONE_KB_BI

          public static final java.math.BigInteger ONE_KB_BI

      The number of bytes in a kilobyte.
      Since:
        2.4

    - #### ONE_MB

          public static final long ONE_MB

      The number of bytes in a megabyte.
      See Also:
        Constant Field Values

    - #### ONE_MB_BI

          public static final java.math.BigInteger ONE_MB_BI

      The number of bytes in a megabyte.
      Since:
        2.4

    - #### FILE_COPY_BUFFER_SIZE

          private static final long FILE_COPY_BUFFER_SIZE

      The file copy buffer size (30 MB)
      See Also:
        Constant Field Values

    - #### ONE_GB

          public static final long ONE_GB

      The number of bytes in a gigabyte.
      See Also:
        Constant Field Values

    - #### ONE_GB_BI

          public static final java.math.BigInteger ONE_GB_BI

      The number of bytes in a gigabyte.
      Since:
        2.4

    - #### ONE_TB

          public static final long ONE_TB

      The number of bytes in a terabyte.
      See Also:
        Constant Field Values

    - #### ONE_TB_BI

          public static final java.math.BigInteger ONE_TB_BI

      The number of bytes in a terabyte.
      Since:
        2.4

    - #### ONE_PB

          public static final long ONE_PB

      The number of bytes in a petabyte.
      See Also:
        Constant Field Values

    - #### ONE_PB_BI

          public static final java.math.BigInteger ONE_PB_BI

      The number of bytes in a petabyte.
      Since:
        2.4

    - #### ONE_EB

          public static final long ONE_EB

      The number of bytes in an exabyte.
      See Also:
        Constant Field Values

    - #### ONE_EB_BI

          public static final java.math.BigInteger ONE_EB_BI

      The number of bytes in an exabyte.
      Since:
        2.4

    - #### ONE_ZB

          public static final java.math.BigInteger ONE_ZB

      The number of bytes in a zettabyte.

    - #### ONE_YB

          public static final java.math.BigInteger ONE_YB

      The number of bytes in a yottabyte.

    - #### EMPTY_FILE_ARRAY

          public static final java.io.File[] EMPTY_FILE_ARRAY

      An empty array of type `File`.

  - ### Constructor Detail

    - #### FileUtils

          public FileUtils()

      Instances should NOT be constructed in standard programming.

  - ### Method Detail

    - #### getFile

          public static java.io.File getFile(java.io.File directory,
                             java.lang.String... names)

      Construct a file from the set of name elements.
      Parameters:
        `directory` - the parent directory
        `names` - the name elements
      Returns:
        the file
      Since:
        2.1

    - #### getFile

          public static java.io.File getFile(java.lang.String... names)

      Construct a file from the set of name elements.
      Parameters:
        `names` - the name elements
      Returns:
        the file
      Since:
        2.1

    - #### getTempDirectoryPath

          public static java.lang.String getTempDirectoryPath()

      Returns the path to the system temporary directory.
      Returns:
        the path to the system temporary directory.
      Since:
        2.0

    - #### getTempDirectory

          public static java.io.File getTempDirectory()

      Returns a `File` representing the system temporary directory.
      Returns:
        the system temporary directory.
      Since:
        2.0

    - #### getUserDirectoryPath

          public static java.lang.String getUserDirectoryPath()

      Returns the path to the user's home directory.
      Returns:
        the path to the user's home directory.
      Since:
        2.0

    - #### getUserDirectory

          public static java.io.File getUserDirectory()

      Returns a `File` representing the user's home directory.
      Returns:
        the user's home directory.
      Since:
        2.0

    - #### openInputStream

          public static java.io.FileInputStream openInputStream(java.io.File file)
                                                         throws java.io.IOException

      Opens a `FileInputStream` for the specified file, providing better error messages than simply calling `new FileInputStream(file)`.

      At the end of the method either the stream will be successfully opened, or an exception will have been thrown.

      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.

      Parameters:
        `file` - the file to open for input, must not be `null`
      Returns:
        a new `FileInputStream` for the specified file
      Throws:
        `java.io.FileNotFoundException` - if the file does not exist
        `java.io.IOException` - if the file object is a directory
        `java.io.IOException` - if the file cannot be read
      Since:
        1.3

    - #### openOutputStream

          public static java.io.FileOutputStream openOutputStream(java.io.File file)
                                                           throws java.io.IOException

      Opens a `FileOutputStream` for the specified file, checking and creating the parent directory if it does not exist.

      At the end of the method either the stream will be successfully opened, or an exception will have been thrown.

      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.

      Parameters:
        `file` - the file to open for output, must not be `null`
      Returns:
        a new `FileOutputStream` for the specified file
      Throws:
        `java.io.IOException` - if the file object is a directory
        `java.io.IOException` - if the file cannot be written to
        `java.io.IOException` - if a parent directory needs creating but that fails
      Since:
        1.3

    - #### openOutputStream

          public static java.io.FileOutputStream openOutputStream(java.io.File file,
                                                  boolean append)
                                                           throws java.io.IOException

      Opens a `FileOutputStream` for the specified file, checking and creating the parent directory if it does not exist.

      At the end of the method either the stream will be successfully opened, or an exception will have been thrown.

      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.

      Parameters:
        `file` - the file to open for output, must not be `null`
        `append` - if `true`, then bytes will be added to the end of the file rather than overwriting
      Returns:
        a new `FileOutputStream` for the specified file
      Throws:
        `java.io.IOException` - if the file object is a directory
        `java.io.IOException` - if the file cannot be written to
        `java.io.IOException` - if a parent directory needs creating but that fails
      Since:
        2.1

    - #### byteCountToDisplaySize

          public static java.lang.String byteCountToDisplaySize(java.math.BigInteger size)

      Returns a human-readable version of the file size, where the input represents a specific number of bytes.

      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.

      Similarly for the 1MB and 1KB boundaries.

      Parameters:
        `size` - the number of bytes
      Returns:
        a human-readable display value (includes units - EB, PB, TB, GB, MB, KB or bytes)
      Since:
        2.4
      See Also:
        IO-226 - should the rounding be changed?

    - #### byteCountToDisplaySize

          public static java.lang.String byteCountToDisplaySize(long size)

      Returns a human-readable version of the file size, where the input represents a specific number of bytes.

      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.

      Similarly for the 1MB and 1KB boundaries.

      Parameters:
        `size` - the number of bytes
      Returns:
        a human-readable display value (includes units - EB, PB, TB, GB, MB, KB or bytes)
      See Also:
        IO-226 - should the rounding be changed?

    - #### touch

          public static void touch(java.io.File file)
                            throws java.io.IOException

      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.

      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.

      Parameters:
        `file` - the File to touch
      Throws:
        `java.io.IOException` - If an I/O problem occurs

    - #### convertFileCollectionToFileArray

          public static java.io.File[] convertFileCollectionToFileArray(java.util.Collection<java.io.File> files)

      Converts a Collection containing java.io.File instanced into array representation. This is to account for the difference between File.listFiles() and FileUtils.listFiles().
      Parameters:
        `files` - a Collection containing java.io.File instances
      Returns:
        an array of java.io.File

    - #### innerListFiles

          private static void innerListFiles(java.util.Collection<java.io.File> files,
                            java.io.File directory,
                            IOFileFilter filter,
                            boolean includeSubDirectories)

      Finds files within a given directory (and optionally its subdirectories). All files found are filtered by an IOFileFilter.
      Parameters:
        `files` - the collection of files found.
        `directory` - the directory to search in.
        `filter` - the filter to apply to files and directories.
        `includeSubDirectories` - indicates if will include the subdirectories themselves

    - #### listFiles

          public static java.util.Collection<java.io.File> listFiles(java.io.File directory,
                                                     IOFileFilter fileFilter,
                                                     IOFileFilter dirFilter)

      Finds files within a given directory (and optionally its subdirectories). All files found are filtered by an IOFileFilter.

      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.

      An example: If you want to search through all directories called "temp" you pass in `FileFilterUtils.NameFileFilter("temp")`

      Another common usage of this method is find files in a directory tree but ignoring the directories generated CVS. You can simply pass in `FileFilterUtils.makeCVSAware(null)`.

      Parameters:
        `directory` - the directory to search in
        `fileFilter` - filter to apply when finding files.
        `dirFilter` - optional filter to apply when finding subdirectories. If this parameter is `null`, subdirectories will not be included in the search. Use TrueFileFilter.INSTANCE to match all directories.
      Returns:
        an collection of java.io.File with the matching files
      See Also:
        `FileFilterUtils`, `NameFileFilter`

    - #### validateListFilesParameters

          private static void validateListFilesParameters(java.io.File directory,
                                         IOFileFilter fileFilter)

      Validates the given arguments.
      - Throws `IllegalArgumentException` if `directory` is not a directory
      - Throws `NullPointerException` if `fileFilter` is null
      Parameters:
        `directory` - The File to test
        `fileFilter` - The IOFileFilter to test

    - #### setUpEffectiveFileFilter

          private static IOFileFilter setUpEffectiveFileFilter(IOFileFilter fileFilter)

      Returns a filter that accepts files in addition to the `File` objects accepted by the given filter.
      Parameters:
        `fileFilter` - a base filter to add to
      Returns:
        a filter that accepts files

    - #### setUpEffectiveDirFilter

          private static IOFileFilter setUpEffectiveDirFilter(IOFileFilter dirFilter)

      Returns a filter that accepts directories in addition to the `File` objects accepted by the given filter.
      Parameters:
        `dirFilter` - a base filter to add to
      Returns:
        a filter that accepts directories

    - #### listFilesAndDirs

          public static java.util.Collection<java.io.File> listFilesAndDirs(java.io.File directory,
                                                            IOFileFilter fileFilter,
                                                            IOFileFilter dirFilter)

      Finds files within a given directory (and optionally its subdirectories). All files found are filtered by an IOFileFilter.

      The resulting collection includes the starting directory and any subdirectories that match the directory filter.

      Parameters:
        `directory` - the directory to search in
        `fileFilter` - filter to apply when finding files.
        `dirFilter` - optional filter to apply when finding subdirectories. If this parameter is `null`, subdirectories will not be included in the search. Use TrueFileFilter.INSTANCE to match all directories.
      Returns:
        an collection of java.io.File with the matching files
      Since:
        2.2
      See Also:
        `listFiles(java.io.File, org.apache.commons.io.filefilter.IOFileFilter, org.apache.commons.io.filefilter.IOFileFilter)`, `FileFilterUtils`, `NameFileFilter`

    - #### iterateFiles

          public static java.util.Iterator<java.io.File> iterateFiles(java.io.File directory,
                                                      IOFileFilter fileFilter,
                                                      IOFileFilter dirFilter)

      Allows iteration over the files in given directory (and optionally its subdirectories).

      All files found are filtered by an IOFileFilter. This method is based on `listFiles(File, IOFileFilter, IOFileFilter)`, which supports Iterable ('foreach' loop).

      Parameters:
        `directory` - the directory to search in
        `fileFilter` - filter to apply when finding files.
        `dirFilter` - optional filter to apply when finding subdirectories. If this parameter is `null`, subdirectories will not be included in the search. Use TrueFileFilter.INSTANCE to match all directories.
      Returns:
        an iterator of java.io.File for the matching files
      Since:
        1.2
      See Also:
        `FileFilterUtils`, `NameFileFilter`

    - #### iterateFilesAndDirs

          public static java.util.Iterator<java.io.File> iterateFilesAndDirs(java.io.File directory,
                                                             IOFileFilter fileFilter,
                                                             IOFileFilter dirFilter)

      Allows iteration over the files in given directory (and optionally its subdirectories).

      All files found are filtered by an IOFileFilter. This method is based on `listFilesAndDirs(File, IOFileFilter, IOFileFilter)`, which supports Iterable ('foreach' loop).

      The resulting iterator includes the subdirectories themselves.

      Parameters:
        `directory` - the directory to search in
        `fileFilter` - filter to apply when finding files.
        `dirFilter` - optional filter to apply when finding subdirectories. If this parameter is `null`, subdirectories will not be included in the search. Use TrueFileFilter.INSTANCE to match all directories.
      Returns:
        an iterator of java.io.File for the matching files
      Since:
        2.2
      See Also:
        `FileFilterUtils`, `NameFileFilter`

    - #### toSuffixes

          private static java.lang.String[] toSuffixes(java.lang.String[] extensions)

      Converts an array of file extensions to suffixes for use with IOFileFilters.
      Parameters:
        `extensions` - an array of extensions. Format: {"java", "xml"}
      Returns:
        an array of suffixes. Format: {".java", ".xml"}

    - #### listFiles

          public static java.util.Collection<java.io.File> listFiles(java.io.File directory,
                                                     java.lang.String[] extensions,
                                                     boolean recursive)

      Finds files within a given directory (and optionally its subdirectories) which match an array of extensions.
      Parameters:
        `directory` - the directory to search in
        `extensions` - an array of extensions, ex. {"java","xml"}. If this parameter is `null`, all files are returned.
        `recursive` - if true all subdirectories are searched as well
      Returns:
        an collection of java.io.File with the matching files

    - #### iterateFiles

          public static java.util.Iterator<java.io.File> iterateFiles(java.io.File directory,
                                                      java.lang.String[] extensions,
                                                      boolean recursive)

      Allows iteration over the files in a given directory (and optionally its subdirectories) which match an array of extensions. This method is based on `listFiles(File, String[], boolean)`, which supports Iterable ('foreach' loop).
      Parameters:
        `directory` - the directory to search in
        `extensions` - an array of extensions, ex. {"java","xml"}. If this parameter is `null`, all files are returned.
        `recursive` - if true all subdirectories are searched as well
      Returns:
        an iterator of java.io.File with the matching files
      Since:
        1.2

    - #### contentEquals

          public static boolean contentEquals(java.io.File file1,
                              java.io.File file2)
                                       throws java.io.IOException

      Compares the contents of two files to determine if they are equal or not.

      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.

      Code origin: Avalon

      Parameters:
        `file1` - the first file
        `file2` - the second file
      Returns:
        true if the content of the files are equal or they both don't exist, false otherwise
      Throws:
        `java.io.IOException` - in case of an I/O error

    - #### contentEqualsIgnoreEOL

          public static boolean contentEqualsIgnoreEOL(java.io.File file1,
                                       java.io.File file2,
                                       java.lang.String charsetName)
                                                throws java.io.IOException

      Compares the contents of two files to determine if they are equal or not.

      This method checks to see if the two files point to the same file, before resorting to line-by-line comparison of the contents.

      Parameters:
        `file1` - the first file
        `file2` - the second file
        `charsetName` - the character encoding to be used. May be null, in which case the platform default is used
      Returns:
        true if the content of the files are equal or neither exists, false otherwise
      Throws:
        `java.io.IOException` - in case of an I/O error
      Since:
        2.2
      See Also:
        `IOUtils.contentEqualsIgnoreEOL(Reader, Reader)`

    - #### toFile

          public static java.io.File toFile(java.net.URL url)

      Convert from a `URL` to a `File`.

      From version 1.1 this method will decode the URL. Syntax such as `file:///my%20docs/file.txt` will be correctly decoded to `/my docs/file.txt`. 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.

      Parameters:
        `url` - the file URL to convert, `null` returns `null`
      Returns:
        the equivalent `File` object, or `null` if the URL's protocol is not `file`

    - #### decodeUrl

          static java.lang.String decodeUrl(java.lang.String url)

      Decodes the specified URL as per RFC 3986, i.e. transforms percent-encoded octets to characters by decoding with the UTF-8 character set. This function is primarily intended for usage with `URL` which unfortunately does not enforce proper URLs. As such, this method will leniently accept invalid characters or malformed percent-encoded octets and simply pass them literally through to the result string. Except for rare edge cases, this will make unencoded URLs pass through unaltered.
      Parameters:
        `url` - The URL to decode, may be `null`.
      Returns:
        The decoded URL or `null` if the input was `null`.

    - #### toFiles

          public static java.io.File[] toFiles(java.net.URL[] urls)

      Converts each of an array of `URL` to a `File`.

      Returns an array of the same size as the input. If the input is `null`, an empty array is returned. If the input contains `null`, the output array contains `null` at the same index.

      This method will decode the URL. Syntax such as `file:///my%20docs/file.txt` will be correctly decoded to `/my docs/file.txt`.

      Parameters:
        `urls` - the file URLs to convert, `null` returns empty array
      Returns:
        a non-`null` array of Files matching the input, with a `null` item if there was a `null` at that index in the input array
      Throws:
        `java.lang.IllegalArgumentException` - if any file is not a URL file
        `java.lang.IllegalArgumentException` - if any file is incorrectly encoded
      Since:
        1.1

    - #### toURLs

          public static java.net.URL[] toURLs(java.io.File[] files)
                                       throws java.io.IOException

      Converts each of an array of `File` to a `URL`.

      Returns an array of the same size as the input.

      Parameters:
        `files` - the files to convert, must not be `null`
      Returns:
        an array of URLs matching the input
      Throws:
        `java.io.IOException` - if a file cannot be converted
        `java.lang.NullPointerException` - if the parameter is null

    - #### copyFileToDirectory

          public static void copyFileToDirectory(java.io.File srcFile,
                                 java.io.File destDir)
                                          throws java.io.IOException

      Copies a file to a directory preserving the file date.

      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.

      Note: This method tries to preserve the file's last modified date/times using `File.setLastModified(long)`, however it is not guaranteed that the operation will succeed. If the modification operation fails, no indication is provided.

      Parameters:
        `srcFile` - an existing file to copy, must not be `null`
        `destDir` - the directory to place the copy in, must not be `null`
      Throws:
        `java.lang.NullPointerException` - if source or destination is null
        `java.io.IOException` - if source or destination is invalid
        `java.io.IOException` - if an IO error occurs during copying
      See Also:
        `copyFile(File, File, boolean)`

    - #### copyFileToDirectory

          public static void copyFileToDirectory(java.io.File srcFile,
                                 java.io.File destDir,
                                 boolean preserveFileDate)
                                          throws java.io.IOException

      Copies a file to a directory optionally preserving the file date.

      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.

      Note: Setting `preserveFileDate` to `true` tries to preserve the file's last modified date/times using `File.setLastModified(long)`, however it is not guaranteed that the operation will succeed. If the modification operation fails, no indication is provided.

      Parameters:
        `srcFile` - an existing file to copy, must not be `null`
        `destDir` - the directory to place the copy in, must not be `null`
        `preserveFileDate` - true if the file date of the copy should be the same as the original
      Throws:
        `java.lang.NullPointerException` - if source or destination is `null`
        `java.io.IOException` - if source or destination is invalid
        `java.io.IOException` - if an IO error occurs during copying
        `java.io.IOException` - if the output file length is not the same as the input file length after the copy completes
      Since:
        1.3
      See Also:
        `copyFile(File, File, boolean)`

    - #### copyFile

          public static void copyFile(java.io.File srcFile,
                      java.io.File destFile)
                               throws java.io.IOException

      Copies a file to a new location preserving the file date.

      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.

      Note: This method tries to preserve the file's last modified date/times using `File.setLastModified(long)`, however it is not guaranteed that the operation will succeed. If the modification operation fails, no indication is provided.

      Parameters:
        `srcFile` - an existing file to copy, must not be `null`
        `destFile` - the new file, must not be `null`
      Throws:
        `java.lang.NullPointerException` - if source or destination is `null`
        `java.io.IOException` - if source or destination is invalid
        `java.io.IOException` - if an IO error occurs during copying
        `java.io.IOException` - if the output file length is not the same as the input file length after the copy completes
      See Also:
        `copyFileToDirectory(File, File)`, `copyFile(File, File, boolean)`

    - #### copyFile

          public static void copyFile(java.io.File srcFile,
                      java.io.File destFile,
                      boolean preserveFileDate)
                               throws java.io.IOException

      Copies a file to a new location.

      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.

      Note: Setting `preserveFileDate` to `true` tries to preserve the file's last modified date/times using `File.setLastModified(long)`, however it is not guaranteed that the operation will succeed. If the modification operation fails, no indication is provided.

      Parameters:
        `srcFile` - an existing file to copy, must not be `null`
        `destFile` - the new file, must not be `null`
        `preserveFileDate` - true if the file date of the copy should be the same as the original
      Throws:
        `java.lang.NullPointerException` - if source or destination is `null`
        `java.io.IOException` - if source or destination is invalid
        `java.io.IOException` - if an IO error occurs during copying
        `java.io.IOException` - if the output file length is not the same as the input file length after the copy completes
      See Also:
        `copyFileToDirectory(File, File, boolean)`, `doCopyFile(File, File, boolean)`

    - #### copyFile

          public static long copyFile(java.io.File input,
                      java.io.OutputStream output)
                               throws java.io.IOException

      Copy bytes from a `File` to an `OutputStream`.

      This method buffers the input internally, so there is no need to use a `BufferedInputStream`.

      Parameters:
        `input` - the `File` to read from
        `output` - the `OutputStream` to write to
      Returns:
        the number of bytes copied
      Throws:
        `java.lang.NullPointerException` - if the input or output is null
        `java.io.IOException` - if an I/O error occurs
      Since:
        2.1

    - #### doCopyFile

          private static void doCopyFile(java.io.File srcFile,
                        java.io.File destFile,
                        boolean preserveFileDate)
                                  throws java.io.IOException

      Internal copy file method. This caches the original file length, and throws an IOException if the output file length is different from the current input file length. So it may fail if the file changes size. It may also fail with "IllegalArgumentException: Negative size" if the input file is truncated part way through copying the data and the new file size is less than the current position.
      Parameters:
        `srcFile` - the validated source file, must not be `null`
        `destFile` - the validated destination file, must not be `null`
        `preserveFileDate` - whether to preserve the file date
      Throws:
        `java.io.IOException` - if an error occurs
        `java.io.IOException` - if the output file length is not the same as the input file length after the copy completes
        `java.lang.IllegalArgumentException` - "Negative size" if the file is truncated so that the size is less than the position

    - #### copyDirectoryToDirectory

          public static void copyDirectoryToDirectory(java.io.File srcDir,
                                      java.io.File destDir)
                                               throws java.io.IOException

      Copies a directory to within another directory preserving the file dates.

      This method copies the source directory and all its contents to a directory of the same name in the specified destination directory.

      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.

      Note: This method tries to preserve the files' last modified date/times using `File.setLastModified(long)`, however it is not guaranteed that those operations will succeed. If the modification operation fails, no indication is provided.

      Parameters:
        `srcDir` - an existing directory to copy, must not be `null`
        `destDir` - the directory to place the copy in, must not be `null`
      Throws:
        `java.lang.NullPointerException` - if source or destination is `null`
        `java.io.IOException` - if source or destination is invalid
        `java.io.IOException` - if an IO error occurs during copying
      Since:
        1.2

    - #### copyDirectory

          public static void copyDirectory(java.io.File srcDir,
                           java.io.File destDir)
                                    throws java.io.IOException

      Copies a whole directory to a new location preserving the file dates.

      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.

      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.

      Note: This method tries to preserve the files' last modified date/times using `File.setLastModified(long)`, however it is not guaranteed that those operations will succeed. If the modification operation fails, no indication is provided.

      Parameters:
        `srcDir` - an existing directory to copy, must not be `null`
        `destDir` - the new directory, must not be `null`
      Throws:
        `java.lang.NullPointerException` - if source or destination is `null`
        `java.io.IOException` - if source or destination is invalid
        `java.io.IOException` - if an IO error occurs during copying
      Since:
        1.1

    - #### copyDirectory

          public static void copyDirectory(java.io.File srcDir,
                           java.io.File destDir,
                           boolean preserveFileDate)
                                    throws java.io.IOException

      Copies a whole directory to a new location.

      This method copies the contents of the specified source directory to within the specified destination directory.

      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.

      Note: Setting `preserveFileDate` to `true` tries to preserve the files' last modified date/times using `File.setLastModified(long)`, however it is not guaranteed that those operations will succeed. If the modification operation fails, no indication is provided.

      Parameters:
        `srcDir` - an existing directory to copy, must not be `null`
        `destDir` - the new directory, must not be `null`
        `preserveFileDate` - true if the file date of the copy should be the same as the original
      Throws:
        `java.lang.NullPointerException` - if source or destination is `null`
        `java.io.IOException` - if source or destination is invalid
        `java.io.IOException` - if an IO error occurs during copying
      Since:
        1.1

    - #### copyDirectory

          public static void copyDirectory(java.io.File srcDir,
                           java.io.File destDir,
                           java.io.FileFilter filter)
                                    throws java.io.IOException

      Copies a filtered directory to a new location preserving the file dates.

      This method copies the contents of the specified source directory to within the specified destination directory.

      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.

      Note: This method tries to preserve the files' last modified date/times using `File.setLastModified(long)`, however it is not guaranteed that those operations will succeed. If the modification operation fails, no indication is provided.

      ### Example: Copy directories only

            // only copy the directory structure
            FileUtils.copyDirectory(srcDir, destDir, DirectoryFileFilter.DIRECTORY);

      ### Example: Copy directories and txt files

            // 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);

      Parameters:
        `srcDir` - an existing directory to copy, must not be `null`
        `destDir` - the new directory, must not be `null`
        `filter` - the filter to apply, null means copy all directories and files should be the same as the original
      Throws:
        `java.lang.NullPointerException` - if source or destination is `null`
        `java.io.IOException` - if source or destination is invalid
        `java.io.IOException` - if an IO error occurs during copying
      Since:
        1.4

    - #### copyDirectory

          public static void copyDirectory(java.io.File srcDir,
                           java.io.File destDir,
                           java.io.FileFilter filter,
                           boolean preserveFileDate)
                                    throws java.io.IOException

      Copies a filtered directory to a new location.

      This method copies the contents of the specified source directory to within the specified destination directory.

      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.

      Note: Setting `preserveFileDate` to `true` tries to preserve the files' last modified date/times using `File.setLastModified(long)`, however it is not guaranteed that those operations will succeed. If the modification operation fails, no indication is provided.

      ### Example: Copy directories only

            // only copy the directory structure
            FileUtils.copyDirectory(srcDir, destDir, DirectoryFileFilter.DIRECTORY, false);

      ### Example: Copy directories and txt files

            // 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);

      Parameters:
        `srcDir` - an existing directory to copy, must not be `null`
        `destDir` - the new directory, must not be `null`
        `filter` - the filter to apply, null means copy all directories and files
        `preserveFileDate` - true if the file date of the copy should be the same as the original
      Throws:
        `java.lang.NullPointerException` - if source or destination is `null`
        `java.io.IOException` - if source or destination is invalid
        `java.io.IOException` - if an IO error occurs during copying
      Since:
        1.4

    - #### checkFileRequirements

          private static void checkFileRequirements(java.io.File src,
                                   java.io.File dest)
                                             throws java.io.FileNotFoundException

      checks requirements for file copy
      Parameters:
        `src` - the source file
        `dest` - the destination
      Throws:
        `java.io.FileNotFoundException` - if the destination does not exist

    - #### doCopyDirectory

          private static void doCopyDirectory(java.io.File srcDir,
                             java.io.File destDir,
                             java.io.FileFilter filter,
                             boolean preserveFileDate,
                             java.util.List<java.lang.String> exclusionList)
                                       throws java.io.IOException

      Internal copy directory method.
      Parameters:
        `srcDir` - the validated source directory, must not be `null`
        `destDir` - the validated destination directory, must not be `null`
        `filter` - the filter to apply, null means copy all directories and files
        `preserveFileDate` - whether to preserve the file date
        `exclusionList` - List of files and directories to exclude from the copy, may be null
      Throws:
        `java.io.IOException` - if an error occurs
      Since:
        1.1

    - #### copyURLToFile

          public static void copyURLToFile(java.net.URL source,
                           java.io.File destination)
                                    throws java.io.IOException

      Copies bytes from the URL `source` to a file `destination`. The directories up to `destination` will be created if they don't already exist. `destination` will be overwritten if it already exists.

      Warning: this method does not set a connection or read timeout and thus might block forever. Use `copyURLToFile(URL, File, int, int)` with reasonable timeouts to prevent this.

      Parameters:
        `source` - the `URL` to copy bytes from, must not be `null`
        `destination` - the non-directory `File` to write bytes to (possibly overwriting), must not be `null`
      Throws:
        `java.io.IOException` - if `source` URL cannot be opened
        `java.io.IOException` - if `destination` is a directory
        `java.io.IOException` - if `destination` cannot be written
        `java.io.IOException` - if `destination` needs creating but can't be
        `java.io.IOException` - if an IO error occurs during copying

    - #### copyURLToFile

          public static void copyURLToFile(java.net.URL source,
                           java.io.File destination,
                           int connectionTimeout,
                           int readTimeout)
                                    throws java.io.IOException

      Copies bytes from the URL `source` to a file `destination`. The directories up to `destination` will be created if they don't already exist. `destination` will be overwritten if it already exists.
      Parameters:
        `source` - the `URL` to copy bytes from, must not be `null`
        `destination` - the non-directory `File` to write bytes to (possibly overwriting), must not be `null`
        `connectionTimeout` - the number of milliseconds until this method will timeout if no connection could be established to the `source`
        `readTimeout` - the number of milliseconds until this method will timeout if no data could be read from the `source`
      Throws:
        `java.io.IOException` - if `source` URL cannot be opened
        `java.io.IOException` - if `destination` is a directory
        `java.io.IOException` - if `destination` cannot be written
        `java.io.IOException` - if `destination` needs creating but can't be
        `java.io.IOException` - if an IO error occurs during copying
      Since:
        2.0

    - #### copyInputStreamToFile

          public static void copyInputStreamToFile(java.io.InputStream source,
                                   java.io.File destination)
                                            throws java.io.IOException

      Copies bytes from an `InputStream` `source` to a file `destination`. The directories up to `destination` will be created if they don't already exist. `destination` will be overwritten if it already exists. The `source` stream is closed. See `copyToFile(InputStream, File)` for a method that does not close the input stream.
      Parameters:
        `source` - the `InputStream` to copy bytes from, must not be `null`, will be closed
        `destination` - the non-directory `File` to write bytes to (possibly overwriting), must not be `null`
      Throws:
        `java.io.IOException` - if `destination` is a directory
        `java.io.IOException` - if `destination` cannot be written
        `java.io.IOException` - if `destination` needs creating but can't be
        `java.io.IOException` - if an IO error occurs during copying
      Since:
        2.0

    - #### copyToFile

          public static void copyToFile(java.io.InputStream source,
                        java.io.File destination)
                                 throws java.io.IOException

      Copies bytes from an `InputStream` `source` to a file `destination`. The directories up to `destination` will be created if they don't already exist. `destination` will be overwritten if it already exists. The `source` stream is left open, e.g. for use with `ZipInputStream`. See `copyInputStreamToFile(InputStream, File)` for a method that closes the input stream.
      Parameters:
        `source` - the `InputStream` to copy bytes from, must not be `null`
        `destination` - the non-directory `File` to write bytes to (possibly overwriting), must not be `null`
      Throws:
        `java.io.IOException` - if `destination` is a directory
        `java.io.IOException` - if `destination` cannot be written
        `java.io.IOException` - if `destination` needs creating but can't be
        `java.io.IOException` - if an IO error occurs during copying
      Since:
        2.5

    - #### deleteDirectory

          public static void deleteDirectory(java.io.File directory)
                                      throws java.io.IOException

      Deletes a directory recursively.
      Parameters:
        `directory` - directory to delete
      Throws:
        `java.io.IOException` - in case deletion is unsuccessful
        `java.lang.IllegalArgumentException` - if `directory` does not exist or is not a directory

    - #### deleteQuietly

          public static boolean deleteQuietly(java.io.File file)

      Deletes a file, never throwing an exception. If file is a directory, delete it and all sub-directories.

      The difference between File.delete() and this method are:

      - A directory to be deleted does not have to be empty.
      - No exceptions are thrown when a file or directory cannot be deleted.
      Parameters:
        `file` - file or directory to delete, can be `null`
      Returns:
        `true` if the file or directory was deleted, otherwise `false`
      Since:
        1.4

    - #### directoryContains

          public static boolean directoryContains(java.io.File directory,
                                  java.io.File child)
                                           throws java.io.IOException

      Determines whether the `parent` directory contains the `child` element (a file or directory).

      Files are normalized before comparison.

      Edge cases:
      - A `directory` must not be null: if null, throw IllegalArgumentException
      - A `directory` must be a directory: if not a directory, throw IllegalArgumentException
      - A directory does not contain itself: return false
      - A null child file is not contained in any parent: return false
      Parameters:
        `directory` - the file to consider as the parent.
        `child` - the file to consider as the child.
      Returns:
        true is the candidate leaf is under by the specified composite. False otherwise.
      Throws:
        `java.io.IOException` - if an IO error occurs while checking the files.
        `java.lang.IllegalArgumentException` - if `directory` is null or not a directory.
      Since:
        2.2
      See Also:
        `FilenameUtils.directoryContains(String, String)`

    - #### cleanDirectory

          public static void cleanDirectory(java.io.File directory)
                                     throws java.io.IOException

      Cleans a directory without deleting it.
      Parameters:
        `directory` - directory to clean
      Throws:
        `java.io.IOException` - in case cleaning is unsuccessful
        `java.lang.IllegalArgumentException` - if `directory` does not exist or is not a directory

    - #### verifiedListFiles

          private static java.io.File[] verifiedListFiles(java.io.File directory)
                                                   throws java.io.IOException

      Lists files in a directory, asserting that the supplied directory satisfies exists and is a directory
      Parameters:
        `directory` - The directory to list
      Returns:
        The files in the directory, never null.
      Throws:
        `java.io.IOException` - if an I/O error occurs

    - #### waitFor

          public static boolean waitFor(java.io.File file,
                        int seconds)

      Waits for NFS to propagate a file creation, imposing a timeout.

      This method repeatedly tests `File.exists()` until it returns true up to the maximum time specified in seconds.

      Parameters:
        `file` - the file to check, must not be `null`
        `seconds` - the maximum time in seconds to wait
      Returns:
        true if file exists
      Throws:
        `java.lang.NullPointerException` - if the file is `null`

    - #### readFileToString

          public static java.lang.String readFileToString(java.io.File file,
                                          java.nio.charset.Charset encoding)
                                                   throws java.io.IOException

      Reads the contents of a file into a String. The file is always closed.
      Parameters:
        `file` - the file to read, must not be `null`
        `encoding` - the encoding to use, `null` means platform default
      Returns:
        the file contents, never `null`
      Throws:
        `java.io.IOException` - in case of an I/O error
      Since:
        2.3

    - #### readFileToString

          public static java.lang.String readFileToString(java.io.File file,
                                          java.lang.String encoding)
                                                   throws java.io.IOException

      Reads the contents of a file into a String. The file is always closed.
      Parameters:
        `file` - the file to read, must not be `null`
        `encoding` - the encoding to use, `null` means platform default
      Returns:
        the file contents, never `null`
      Throws:
        `java.io.IOException` - in case of an I/O error
        `java.nio.charset.UnsupportedCharsetException` - thrown instead of `.UnsupportedEncodingException` in version 2.2 if the encoding is not supported.
      Since:
        2.3

    - #### readFileToString

          @Deprecated
          public static java.lang.String readFileToString(java.io.File file)
                                                   throws java.io.IOException

      Deprecated. 2.5 use `readFileToString(File, Charset)` instead
      Reads the contents of a file into a String using the default encoding for the VM. The file is always closed.
      Parameters:
        `file` - the file to read, must not be `null`
      Returns:
        the file contents, never `null`
      Throws:
        `java.io.IOException` - in case of an I/O error
      Since:
        1.3.1

    - #### readFileToByteArray

          public static byte[] readFileToByteArray(java.io.File file)
                                            throws java.io.IOException

      Reads the contents of a file into a byte array. The file is always closed.
      Parameters:
        `file` - the file to read, must not be `null`
      Returns:
        the file contents, never `null`
      Throws:
        `java.io.IOException` - in case of an I/O error
      Since:
        1.1

    - #### readLines

          public static java.util.List<java.lang.String> readLines(java.io.File file,
                                                   java.nio.charset.Charset encoding)
                                                            throws java.io.IOException

      Reads the contents of a file line by line to a List of Strings. The file is always closed.
      Parameters:
        `file` - the file to read, must not be `null`
        `encoding` - the encoding to use, `null` means platform default
      Returns:
        the list of Strings representing each line in the file, never `null`
      Throws:
        `java.io.IOException` - in case of an I/O error
      Since:
        2.3

    - #### readLines

          public static java.util.List<java.lang.String> readLines(java.io.File file,
                                                   java.lang.String encoding)
                                                            throws java.io.IOException

      Reads the contents of a file line by line to a List of Strings. The file is always closed.
      Parameters:
        `file` - the file to read, must not be `null`
        `encoding` - the encoding to use, `null` means platform default
      Returns:
        the list of Strings representing each line in the file, never `null`
      Throws:
        `java.io.IOException` - in case of an I/O error
        `java.nio.charset.UnsupportedCharsetException` - thrown instead of `.UnsupportedEncodingException` in version 2.2 if the encoding is not supported.
      Since:
        1.1

    - #### readLines

          @Deprecated
          public static java.util.List<java.lang.String> readLines(java.io.File file)
                                                            throws java.io.IOException

      Deprecated. 2.5 use `readLines(File, Charset)` instead
      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.
      Parameters:
        `file` - the file to read, must not be `null`
      Returns:
        the list of Strings representing each line in the file, never `null`
      Throws:
        `java.io.IOException` - in case of an I/O error
      Since:
        1.3

    - #### lineIterator

          public static LineIterator lineIterator(java.io.File file,
                                  java.lang.String encoding)
                                           throws java.io.IOException

      Returns an Iterator for the lines in a `File`.

      This method opens an `InputStream` 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 `LineIterator.close()` or `LineIterator.closeQuietly(LineIterator)` method.

      The recommended usage pattern is:

           LineIterator it = FileUtils.lineIterator(file, "UTF-8");
           try {
             while (it.hasNext()) {
               String line = it.nextLine();
               /// do something with line
             }
           } finally {
             LineIterator.closeQuietly(iterator);
           }

      If an exception occurs during the creation of the iterator, the underlying stream is closed.

      Parameters:
        `file` - the file to open for input, must not be `null`
        `encoding` - the encoding to use, `null` means platform default
      Returns:
        an Iterator of the lines in the file, never `null`
      Throws:
        `java.io.IOException` - in case of an I/O error (file closed)
      Since:
        1.2

    - #### lineIterator

          public static LineIterator lineIterator(java.io.File file)
                                           throws java.io.IOException

      Returns an Iterator for the lines in a `File` using the default encoding for the VM.
      Parameters:
        `file` - the file to open for input, must not be `null`
      Returns:
        an Iterator of the lines in the file, never `null`
      Throws:
        `java.io.IOException` - in case of an I/O error (file closed)
      Since:
        1.3
      See Also:
        `lineIterator(File, String)`

    - #### writeStringToFile

          public static void writeStringToFile(java.io.File file,
                               java.lang.String data,
                               java.nio.charset.Charset encoding)
                                        throws java.io.IOException

      Writes a String to a file creating the file if it does not exist.

      NOTE: As from v1.3, the parent directories of the file will be created if they do not exist.

      Parameters:
        `file` - the file to write
        `data` - the content to write to the file
        `encoding` - the encoding to use, `null` means platform default
      Throws:
        `java.io.IOException` - in case of an I/O error
        `java.io.UnsupportedEncodingException` - if the encoding is not supported by the VM
      Since:
        2.4

    - #### writeStringToFile

          public static void writeStringToFile(java.io.File file,
                               java.lang.String data,
                               java.lang.String encoding)
                                        throws java.io.IOException

      Writes a String to a file creating the file if it does not exist.

      NOTE: As from v1.3, the parent directories of the file will be created if they do not exist.

      Parameters:
        `file` - the file to write
        `data` - the content to write to the file
        `encoding` - the encoding to use, `null` means platform default
      Throws:
        `java.io.IOException` - in case of an I/O error
        `java.io.UnsupportedEncodingException` - if the encoding is not supported by the VM

    - #### writeStringToFile

          public static void writeStringToFile(java.io.File file,
                               java.lang.String data,
                               java.nio.charset.Charset encoding,
                               boolean append)
                                        throws java.io.IOException

      Writes a String to a file creating the file if it does not exist.
      Parameters:
        `file` - the file to write
        `data` - the content to write to the file
        `encoding` - the encoding to use, `null` means platform default
        `append` - if `true`, then the String will be added to the end of the file rather than overwriting
      Throws:
        `java.io.IOException` - in case of an I/O error
      Since:
        2.3

    - #### writeStringToFile

          public static void writeStringToFile(java.io.File file,
                               java.lang.String data,
                               java.lang.String encoding,
                               boolean append)
                                        throws java.io.IOException

      Writes a String to a file creating the file if it does not exist.
      Parameters:
        `file` - the file to write
        `data` - the content to write to the file
        `encoding` - the encoding to use, `null` means platform default
        `append` - if `true`, then the String will be added to the end of the file rather than overwriting
      Throws:
        `java.io.IOException` - in case of an I/O error
        `java.nio.charset.UnsupportedCharsetException` - thrown instead of `.UnsupportedEncodingException` in version 2.2 if the encoding is not supported by the VM
      Since:
        2.1

    - #### writeStringToFile

          @Deprecated
          public static void writeStringToFile(java.io.File file,
                                          java.lang.String data)
                                        throws java.io.IOException

      Deprecated. 2.5 use `writeStringToFile(File, String, Charset)` instead
      Writes a String to a file creating the file if it does not exist using the default encoding for the VM.
      Parameters:
        `file` - the file to write
        `data` - the content to write to the file
      Throws:
        `java.io.IOException` - in case of an I/O error

    - #### writeStringToFile

          @Deprecated
          public static void writeStringToFile(java.io.File file,
                                          java.lang.String data,
                                          boolean append)
                                        throws java.io.IOException

      Deprecated. 2.5 use `writeStringToFile(File, String, Charset, boolean)` instead
      Writes a String to a file creating the file if it does not exist using the default encoding for the VM.
      Parameters:
        `file` - the file to write
        `data` - the content to write to the file
        `append` - if `true`, then the String will be added to the end of the file rather than overwriting
      Throws:
        `java.io.IOException` - in case of an I/O error
      Since:
        2.1

    - #### write

          @Deprecated
          public static void write(java.io.File file,
                              java.lang.CharSequence data)
                            throws java.io.IOException

      Deprecated. 2.5 use `write(File, CharSequence, Charset)` instead
      Writes a CharSequence to a file creating the file if it does not exist using the default encoding for the VM.
      Parameters:
        `file` - the file to write
        `data` - the content to write to the file
      Throws:
        `java.io.IOException` - in case of an I/O error
      Since:
        2.0

    - #### write

          @Deprecated
          public static void write(java.io.File file,
                              java.lang.CharSequence data,
                              boolean append)
                            throws java.io.IOException

      Deprecated. 2.5 use `write(File, CharSequence, Charset, boolean)` instead
      Writes a CharSequence to a file creating the file if it does not exist using the default encoding for the VM.
      Parameters:
        `file` - the file to write
        `data` - the content to write to the file
        `append` - if `true`, then the data will be added to the end of the file rather than overwriting
      Throws:
        `java.io.IOException` - in case of an I/O error
      Since:
        2.1

    - #### write

          public static void write(java.io.File file,
                   java.lang.CharSequence data,
                   java.nio.charset.Charset encoding)
                            throws java.io.IOException

      Writes a CharSequence to a file creating the file if it does not exist.
      Parameters:
        `file` - the file to write
        `data` - the content to write to the file
        `encoding` - the encoding to use, `null` means platform default
      Throws:
        `java.io.IOException` - in case of an I/O error
      Since:
        2.3

    - #### write

          public static void write(java.io.File file,
                   java.lang.CharSequence data,
                   java.lang.String encoding)
                            throws java.io.IOException

      Writes a CharSequence to a file creating the file if it does not exist.
      Parameters:
        `file` - the file to write
        `data` - the content to write to the file
        `encoding` - the encoding to use, `null` means platform default
      Throws:
        `java.io.IOException` - in case of an I/O error
        `java.io.UnsupportedEncodingException` - if the encoding is not supported by the VM
      Since:
        2.0

    - #### write

          public static void write(java.io.File file,
                   java.lang.CharSequence data,
                   java.nio.charset.Charset encoding,
                   boolean append)
                            throws java.io.IOException

      Writes a CharSequence to a file creating the file if it does not exist.
      Parameters:
        `file` - the file to write
        `data` - the content to write to the file
        `encoding` - the encoding to use, `null` means platform default
        `append` - if `true`, then the data will be added to the end of the file rather than overwriting
      Throws:
        `java.io.IOException` - in case of an I/O error
      Since:
        2.3

    - #### write

          public static void write(java.io.File file,
                   java.lang.CharSequence data,
                   java.lang.String encoding,
                   boolean append)
                            throws java.io.IOException

      Writes a CharSequence to a file creating the file if it does not exist.
      Parameters:
        `file` - the file to write
        `data` - the content to write to the file
        `encoding` - the encoding to use, `null` means platform default
        `append` - if `true`, then the data will be added to the end of the file rather than overwriting
      Throws:
        `java.io.IOException` - in case of an I/O error
        `java.nio.charset.UnsupportedCharsetException` - thrown instead of `.UnsupportedEncodingException` in version 2.2 if the encoding is not supported by the VM
      Since:
        2.1

    - #### writeByteArrayToFile

          public static void writeByteArrayToFile(java.io.File file,
                                  byte[] data)
                                           throws java.io.IOException

      Writes a byte array to a file creating the file if it does not exist.

      NOTE: As from v1.3, the parent directories of the file will be created if they do not exist.

      Parameters:
        `file` - the file to write to
        `data` - the content to write to the file
      Throws:
        `java.io.IOException` - in case of an I/O error
      Since:
        1.1

    - #### writeByteArrayToFile

          public static void writeByteArrayToFile(java.io.File file,
                                  byte[] data,
                                  boolean append)
                                           throws java.io.IOException

      Writes a byte array to a file creating the file if it does not exist.
      Parameters:
        `file` - the file to write to
        `data` - the content to write to the file
        `append` - if `true`, then bytes will be added to the end of the file rather than overwriting
      Throws:
        `java.io.IOException` - in case of an I/O error
      Since:
        2.1

    - #### writeByteArrayToFile

          public static void writeByteArrayToFile(java.io.File file,
                                  byte[] data,
                                  int off,
                                  int len)
                                           throws java.io.IOException

      Writes `len` bytes from the specified byte array starting at offset `off` to a file, creating the file if it does not exist.
      Parameters:
        `file` - the file to write to
        `data` - the content to write to the file
        `off` - the start offset in the data
        `len` - the number of bytes to write
      Throws:
        `java.io.IOException` - in case of an I/O error
      Since:
        2.5

    - #### writeByteArrayToFile

          public static void writeByteArrayToFile(java.io.File file,
                                  byte[] data,
                                  int off,
                                  int len,
                                  boolean append)
                                           throws java.io.IOException

      Writes `len` bytes from the specified byte array starting at offset `off` to a file, creating the file if it does not exist.
      Parameters:
        `file` - the file to write to
        `data` - the content to write to the file
        `off` - the start offset in the data
        `len` - the number of bytes to write
        `append` - if `true`, then bytes will be added to the end of the file rather than overwriting
      Throws:
        `java.io.IOException` - in case of an I/O error
      Since:
        2.5

    - #### writeLines

          public static void writeLines(java.io.File file,
                        java.lang.String encoding,
                        java.util.Collection<?> lines)
                                 throws java.io.IOException

      Writes the `toString()` value of each item in a collection to the specified `File` line by line. The specified character encoding and the default line ending will be used.

      NOTE: As from v1.3, the parent directories of the file will be created if they do not exist.

      Parameters:
        `file` - the file to write to
        `encoding` - the encoding to use, `null` means platform default
        `lines` - the lines to write, `null` entries produce blank lines
      Throws:
        `java.io.IOException` - in case of an I/O error
        `java.io.UnsupportedEncodingException` - if the encoding is not supported by the VM
      Since:
        1.1

    - #### writeLines

          public static void writeLines(java.io.File file,
                        java.lang.String encoding,
                        java.util.Collection<?> lines,
                        boolean append)
                                 throws java.io.IOException

      Writes the `toString()` value of each item in a collection to the specified `File` line by line, optionally appending. The specified character encoding and the default line ending will be used.
      Parameters:
        `file` - the file to write to
        `encoding` - the encoding to use, `null` means platform default
        `lines` - the lines to write, `null` entries produce blank lines
        `append` - if `true`, then the lines will be added to the end of the file rather than overwriting
      Throws:
        `java.io.IOException` - in case of an I/O error
        `java.io.UnsupportedEncodingException` - if the encoding is not supported by the VM
      Since:
        2.1

    - #### writeLines

          public static void writeLines(java.io.File file,
                        java.util.Collection<?> lines)
                                 throws java.io.IOException

      Writes the `toString()` value of each item in a collection to the specified `File` line by line. The default VM encoding and the default line ending will be used.
      Parameters:
        `file` - the file to write to
        `lines` - the lines to write, `null` entries produce blank lines
      Throws:
        `java.io.IOException` - in case of an I/O error
      Since:
        1.3

    - #### writeLines

          public static void writeLines(java.io.File file,
                        java.util.Collection<?> lines,
                        boolean append)
                                 throws java.io.IOException

      Writes the `toString()` value of each item in a collection to the specified `File` line by line. The default VM encoding and the default line ending will be used.
      Parameters:
        `file` - the file to write to
        `lines` - the lines to write, `null` entries produce blank lines
        `append` - if `true`, then the lines will be added to the end of the file rather than overwriting
      Throws:
        `java.io.IOException` - in case of an I/O error
      Since:
        2.1

    - #### writeLines

          public static void writeLines(java.io.File file,
                        java.lang.String encoding,
                        java.util.Collection<?> lines,
                        java.lang.String lineEnding)
                                 throws java.io.IOException

      Writes the `toString()` value of each item in a collection to the specified `File` line by line. The specified character encoding and the line ending will be used.

      NOTE: As from v1.3, the parent directories of the file will be created if they do not exist.

      Parameters:
        `file` - the file to write to
        `encoding` - the encoding to use, `null` means platform default
        `lines` - the lines to write, `null` entries produce blank lines
        `lineEnding` - the line separator to use, `null` is system default
      Throws:
        `java.io.IOException` - in case of an I/O error
        `java.io.UnsupportedEncodingException` - if the encoding is not supported by the VM
      Since:
        1.1

    - #### writeLines

          public static void writeLines(java.io.File file,
                        java.lang.String encoding,
                        java.util.Collection<?> lines,
                        java.lang.String lineEnding,
                        boolean append)
                                 throws java.io.IOException

      Writes the `toString()` value of each item in a collection to the specified `File` line by line. The specified character encoding and the line ending will be used.
      Parameters:
        `file` - the file to write to
        `encoding` - the encoding to use, `null` means platform default
        `lines` - the lines to write, `null` entries produce blank lines
        `lineEnding` - the line separator to use, `null` is system default
        `append` - if `true`, then the lines will be added to the end of the file rather than overwriting
      Throws:
        `java.io.IOException` - in case of an I/O error
        `java.io.UnsupportedEncodingException` - if the encoding is not supported by the VM
      Since:
        2.1

    - #### writeLines

          public static void writeLines(java.io.File file,
                        java.util.Collection<?> lines,
                        java.lang.String lineEnding)
                                 throws java.io.IOException

      Writes the `toString()` value of each item in a collection to the specified `File` line by line. The default VM encoding and the specified line ending will be used.
      Parameters:
        `file` - the file to write to
        `lines` - the lines to write, `null` entries produce blank lines
        `lineEnding` - the line separator to use, `null` is system default
      Throws:
        `java.io.IOException` - in case of an I/O error
      Since:
        1.3

    - #### writeLines

          public static void writeLines(java.io.File file,
                        java.util.Collection<?> lines,
                        java.lang.String lineEnding,
                        boolean append)
                                 throws java.io.IOException

      Writes the `toString()` value of each item in a collection to the specified `File` line by line. The default VM encoding and the specified line ending will be used.
      Parameters:
        `file` - the file to write to
        `lines` - the lines to write, `null` entries produce blank lines
        `lineEnding` - the line separator to use, `null` is system default
        `append` - if `true`, then the lines will be added to the end of the file rather than overwriting
      Throws:
        `java.io.IOException` - in case of an I/O error
      Since:
        2.1

    - #### forceDelete

          public static void forceDelete(java.io.File file)
                                  throws java.io.IOException

      Deletes a file. If file is a directory, delete it and all sub-directories.

      The difference between File.delete() and this method are:

      - A directory to be deleted does not have to be empty.
      - You get exceptions when a file or directory cannot be deleted. (java.io.File methods returns a boolean)
      Parameters:
        `file` - file or directory to delete, must not be `null`
      Throws:
        `java.lang.NullPointerException` - if the directory is `null`
        `java.io.FileNotFoundException` - if the file was not found
        `java.io.IOException` - in case deletion is unsuccessful

    - #### forceDeleteOnExit

          public static void forceDeleteOnExit(java.io.File file)
                                        throws java.io.IOException

      Schedules a file to be deleted when JVM exits. If file is directory delete it and all sub-directories.
      Parameters:
        `file` - file or directory to delete, must not be `null`
      Throws:
        `java.lang.NullPointerException` - if the file is `null`
        `java.io.IOException` - in case deletion is unsuccessful

    - #### deleteDirectoryOnExit

          private static void deleteDirectoryOnExit(java.io.File directory)
                                             throws java.io.IOException

      Schedules a directory recursively for deletion on JVM exit.
      Parameters:
        `directory` - directory to delete, must not be `null`
      Throws:
        `java.lang.NullPointerException` - if the directory is `null`
        `java.io.IOException` - in case deletion is unsuccessful

    - #### cleanDirectoryOnExit

          private static void cleanDirectoryOnExit(java.io.File directory)
                                            throws java.io.IOException

      Cleans a directory without deleting it.
      Parameters:
        `directory` - directory to clean, must not be `null`
      Throws:
        `java.lang.NullPointerException` - if the directory is `null`
        `java.io.IOException` - in case cleaning is unsuccessful

    - #### forceMkdir

          public static void forceMkdir(java.io.File directory)
                                 throws java.io.IOException

      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.
      Parameters:
        `directory` - directory to create, must not be `null`
      Throws:
        `java.lang.NullPointerException` - if the directory is `null`
        `java.io.IOException` - if the directory cannot be created or the file already exists but is not a directory

    - #### forceMkdirParent

          public static void forceMkdirParent(java.io.File file)
                                       throws java.io.IOException

      Makes any necessary but nonexistent parent directories for a given File. If the parent directory cannot be created then an IOException is thrown.
      Parameters:
        `file` - file with parent to create, must not be `null`
      Throws:
        `java.lang.NullPointerException` - if the file is `null`
        `java.io.IOException` - if the parent directory cannot be created
      Since:
        2.5

    - #### sizeOf

          public static long sizeOf(java.io.File file)

      Returns the size of the specified file or directory. If the provided `File` 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.

      Note that overflow is not detected, and the return value may be negative if overflow occurs. See `sizeOfAsBigInteger(File)` for an alternative method that does not overflow.

      Parameters:
        `file` - the regular file or directory to return the size of (must not be `null`).
      Returns:
        the length of the file, or recursive size of the directory, provided (in bytes).
      Throws:
        `java.lang.NullPointerException` - if the file is `null`
        `java.lang.IllegalArgumentException` - if the file does not exist.
      Since:
        2.0

    - #### sizeOfAsBigInteger

          public static java.math.BigInteger sizeOfAsBigInteger(java.io.File file)

      Returns the size of the specified file or directory. If the provided `File` 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.
      Parameters:
        `file` - the regular file or directory to return the size of (must not be `null`).
      Returns:
        the length of the file, or recursive size of the directory, provided (in bytes).
      Throws:
        `java.lang.NullPointerException` - if the file is `null`
        `java.lang.IllegalArgumentException` - if the file does not exist.
      Since:
        2.4

    - #### sizeOfDirectory

          public static long sizeOfDirectory(java.io.File directory)

      Counts the size of a directory recursively (sum of the length of all files).

      Note that overflow is not detected, and the return value may be negative if overflow occurs. See `sizeOfDirectoryAsBigInteger(File)` for an alternative method that does not overflow.

      Parameters:
        `directory` - directory to inspect, must not be `null`
      Returns:
        size of directory in bytes, 0 if directory is security restricted, a negative number when the real total is greater than `Long.MAX_VALUE`.
      Throws:
        `java.lang.NullPointerException` - if the directory is `null`

    - #### sizeOfDirectory0

          private static long sizeOfDirectory0(java.io.File directory)

      the size of a director
      Parameters:
        `directory` - the directory to check
      Returns:
        the size

    - #### sizeOf0

          private static long sizeOf0(java.io.File file)

      the size of a file
      Parameters:
        `file` - the file to check
      Returns:
        the size of the fil

    - #### sizeOfDirectoryAsBigInteger

          public static java.math.BigInteger sizeOfDirectoryAsBigInteger(java.io.File directory)

      Counts the size of a directory recursively (sum of the length of all files).
      Parameters:
        `directory` - directory to inspect, must not be `null`
      Returns:
        size of directory in bytes, 0 if directory is security restricted.
      Throws:
        `java.lang.NullPointerException` - if the directory is `null`
      Since:
        2.4

    - #### sizeOfDirectoryBig0

          private static java.math.BigInteger sizeOfDirectoryBig0(java.io.File directory)

      Finds the size of a directory
      Parameters:
        `directory` - The directory
      Returns:
        the size

    - #### sizeOfBig0

          private static java.math.BigInteger sizeOfBig0(java.io.File fileOrDir)

      Returns the sid of a file
      Parameters:
        `fileOrDir` - The file
      Returns:
        the size

    - #### checkDirectory

          private static void checkDirectory(java.io.File directory)

      Checks that the given `File` exists and is a directory.
      Parameters:
        `directory` - The `File` to check.
      Throws:
        `java.lang.IllegalArgumentException` - if the given `File` does not exist or is not a directory.

    - #### isFileNewer

          public static boolean isFileNewer(java.io.File file,
                            java.io.File reference)

      Tests if the specified `File` is newer than the reference `File`.
      Parameters:
        `file` - the `File` of which the modification date must be compared, must not be `null`
        `reference` - the `File` of which the modification date is used, must not be `null`
      Returns:
        true if the `File` exists and has been modified more recently than the reference `File`
      Throws:
        `java.lang.IllegalArgumentException` - if the file is `null`
        `java.lang.IllegalArgumentException` - if the reference file is `null` or doesn't exist

    - #### isFileNewer

          public static boolean isFileNewer(java.io.File file,
                            java.util.Date date)

      Tests if the specified `File` is newer than the specified `Date`.
      Parameters:
        `file` - the `File` of which the modification date must be compared, must not be `null`
        `date` - the date reference, must not be `null`
      Returns:
        true if the `File` exists and has been modified after the given `Date`.
      Throws:
        `java.lang.IllegalArgumentException` - if the file is `null`
        `java.lang.IllegalArgumentException` - if the date is `null`

    - #### isFileNewer

          public static boolean isFileNewer(java.io.File file,
                            long timeMillis)

      Tests if the specified `File` is newer than the specified time reference.
      Parameters:
        `file` - the `File` of which the modification date must be compared, must not be `null`
        `timeMillis` - the time reference measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970)
      Returns:
        true if the `File` exists and has been modified after the given time reference.
      Throws:
        `java.lang.IllegalArgumentException` - if the file is `null`

    - #### isFileOlder

          public static boolean isFileOlder(java.io.File file,
                            java.io.File reference)

      Tests if the specified `File` is older than the reference `File`.
      Parameters:
        `file` - the `File` of which the modification date must be compared, must not be `null`
        `reference` - the `File` of which the modification date is used, must not be `null`
      Returns:
        true if the `File` exists and has been modified before the reference `File`
      Throws:
        `java.lang.IllegalArgumentException` - if the file is `null`
        `java.lang.IllegalArgumentException` - if the reference file is `null` or doesn't exist

    - #### isFileOlder

          public static boolean isFileOlder(java.io.File file,
                            java.util.Date date)

      Tests if the specified `File` is older than the specified `Date`.
      Parameters:
        `file` - the `File` of which the modification date must be compared, must not be `null`
        `date` - the date reference, must not be `null`
      Returns:
        true if the `File` exists and has been modified before the given `Date`.
      Throws:
        `java.lang.IllegalArgumentException` - if the file is `null`
        `java.lang.IllegalArgumentException` - if the date is `null`

    - #### isFileOlder

          public static boolean isFileOlder(java.io.File file,
                            long timeMillis)

      Tests if the specified `File` is older than the specified time reference.
      Parameters:
        `file` - the `File` of which the modification date must be compared, must not be `null`
        `timeMillis` - the time reference measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970)
      Returns:
        true if the `File` exists and has been modified before the given time reference.
      Throws:
        `java.lang.IllegalArgumentException` - if the file is `null`

    - #### checksumCRC32

          public static long checksumCRC32(java.io.File file)
                                    throws java.io.IOException

      Computes the checksum of a file using the CRC32 checksum routine. The value of the checksum is returned.
      Parameters:
        `file` - the file to checksum, must not be `null`
      Returns:
        the checksum value
      Throws:
        `java.lang.NullPointerException` - if the file or checksum is `null`
        `java.lang.IllegalArgumentException` - if the file is a directory
        `java.io.IOException` - if an IO error occurs reading the file
      Since:
        1.3

    - #### checksum

          public static java.util.zip.Checksum checksum(java.io.File file,
                                        java.util.zip.Checksum checksum)
                                                 throws java.io.IOException

      Computes the checksum of a file using the specified checksum object. Multiple files may be checked using one `Checksum` instance if desired simply by reusing the same checksum object. For example:

             long csum = FileUtils.checksum(file, new CRC32()).getValue();

      Parameters:
        `file` - the file to checksum, must not be `null`
        `checksum` - the checksum object to be used, must not be `null`
      Returns:
        the checksum specified, updated with the content of the file
      Throws:
        `java.lang.NullPointerException` - if the file or checksum is `null`
        `java.lang.IllegalArgumentException` - if the file is a directory
        `java.io.IOException` - if an IO error occurs reading the file
      Since:
        1.3

    - #### moveDirectory

          public static void moveDirectory(java.io.File srcDir,
                           java.io.File destDir)
                                    throws java.io.IOException

      Moves a directory.

      When the destination directory is on another file system, do a "copy and delete".

      Parameters:
        `srcDir` - the directory to be moved
        `destDir` - the destination directory
      Throws:
        `java.lang.NullPointerException` - if source or destination is `null`
        `FileExistsException` - if the destination directory exists
        `java.io.IOException` - if source or destination is invalid
        `java.io.IOException` - if an IO error occurs moving the file
      Since:
        1.4

    - #### moveDirectoryToDirectory

          public static void moveDirectoryToDirectory(java.io.File src,
                                      java.io.File destDir,
                                      boolean createDestDir)
                                               throws java.io.IOException

      Moves a directory to another directory.
      Parameters:
        `src` - the file to be moved
        `destDir` - the destination file
        `createDestDir` - If `true` create the destination directory, otherwise if `false` throw an IOException
      Throws:
        `java.lang.NullPointerException` - if source or destination is `null`
        `FileExistsException` - if the directory exists in the destination directory
        `java.io.IOException` - if source or destination is invalid
        `java.io.IOException` - if an IO error occurs moving the file
      Since:
        1.4

    - #### moveFile

          public static void moveFile(java.io.File srcFile,
                      java.io.File destFile)
                               throws java.io.IOException

      Moves a file.

      When the destination file is on another file system, do a "copy and delete".

      Parameters:
        `srcFile` - the file to be moved
        `destFile` - the destination file
      Throws:
        `java.lang.NullPointerException` - if source or destination is `null`
        `FileExistsException` - if the destination file exists
        `java.io.IOException` - if source or destination is invalid
        `java.io.IOException` - if an IO error occurs moving the file
      Since:
        1.4

    - #### moveFileToDirectory

          public static void moveFileToDirectory(java.io.File srcFile,
                                 java.io.File destDir,
                                 boolean createDestDir)
                                          throws java.io.IOException

      Moves a file to a directory.
      Parameters:
        `srcFile` - the file to be moved
        `destDir` - the destination file
        `createDestDir` - If `true` create the destination directory, otherwise if `false` throw an IOException
      Throws:
        `java.lang.NullPointerException` - if source or destination is `null`
        `FileExistsException` - if the destination file exists
        `java.io.IOException` - if source or destination is invalid
        `java.io.IOException` - if an IO error occurs moving the file
      Since:
        1.4

    - #### moveToDirectory

          public static void moveToDirectory(java.io.File src,
                             java.io.File destDir,
                             boolean createDestDir)
                                      throws java.io.IOException

      Moves a file or directory to the destination directory.

      When the destination is on another file system, do a "copy and delete".

      Parameters:
        `src` - the file or directory to be moved
        `destDir` - the destination directory
        `createDestDir` - If `true` create the destination directory, otherwise if `false` throw an IOException
      Throws:
        `java.lang.NullPointerException` - if source or destination is `null`
        `FileExistsException` - if the directory or file exists in the destination directory
        `java.io.IOException` - if source or destination is invalid
        `java.io.IOException` - if an IO error occurs moving the file
      Since:
        1.4

    - #### isSymlink

          public static boolean isSymlink(java.io.File file)
                                   throws java.io.IOException

      Determines whether the specified file is a Symbolic Link rather than an actual file.

      Will not return true if there is a Symbolic Link anywhere in the path, only if the specific file is.

      When using jdk1.7, this method delegates to `boolean java.nio.file.Files.isSymbolicLink(Path path)` Note: the current implementation always returns `false` if running on jkd1.6 and the system is detected as Windows using `FilenameUtils.isSystemWindows()`

      For code that runs on Java 1.7 or later, use the following method instead:
      `boolean java.nio.file.Files.isSymbolicLink(Path path)`

      Parameters:
        `file` - the file to check
      Returns:
        true if the file is a Symbolic Link
      Throws:
        `java.io.IOException` - if an IO error occurs while checking the file
      Since:
        2.0

    - #### isBrokenSymlink

          private static boolean isBrokenSymlink(java.io.File file)
                                          throws java.io.IOException

      Determines if the specified file is possibly a broken symbolic link.
      Parameters:
        `file` - the file to check
      Returns:
        true if the file is a Symbolic Link
      Throws:
        `java.io.IOException` - if an IO error occurs while checking the file

Copyright (c) 2002-2016 Apache Software Foundation