Java org.apache.commons.io FileUtils fields, constructors, methods, implement or subclass

Example usage for Java org.apache.commons.io FileUtils fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for org.apache.commons.io FileUtils.

The text is from its open source code.

Subclass

org.apache.commons.io.FileUtils has subclasses.
Click this link to see all its subclasses.

Field

longONE_KB
The number of bytes in a kilobyte.
longONE_MB
The number of bytes in a megabyte.
longONE_GB
The number of bytes in a gigabyte.
File[]EMPTY_FILE_ARRAY
An empty array of type File.

Constructor

FileUtils()
Instances should NOT be constructed in standard programming.

Method

StringbyteCountToDisplaySize(long size)
Returns a human-readable version of the file size, where the input represents a specific number of bytes.
Checksumchecksum(File file, Checksum checksum)
Computes the checksum of a file using the specified checksum object.
longchecksumCRC32(File file)
Computes the checksum of a file using the CRC32 checksum routine.
voidcleanDirectory(File directory)
Cleans a directory without deleting it.
booleancontentEquals(File file1, File file2)
Compares the contents of two files to determine if they are equal or not.
File[]convertFileCollectionToFileArray(Collection files)
Converts a Collection containing java.io.File instanced into array representation.
voidcopyDirectory(File srcDir, File destDir)
Copies a whole directory to a new location preserving the file dates.
voidcopyDirectory(File srcDir, File destDir, boolean preserveFileDate)
Copies a whole directory to a new location.
voidcopyDirectory(File srcDir, File destDir, FileFilter filter)
Copies a filtered directory to a new location preserving the file dates.
voidcopyDirectory(File srcDir, File destDir, FileFilter filter, boolean preserveFileDate)
Copies a filtered directory to a new location.
voidcopyDirectoryToDirectory(File srcDir, File destDir)
Copies a directory to within another directory preserving the file dates.
voidcopyFile(File srcFile, File destFile)
Copies a file to a new location preserving the file date.
voidcopyFile(File srcFile, File destFile, boolean preserveFileDate)
Copies a file to a new location.
voidcopyFileToDirectory(File srcFile, File destDir)
Copies a file to a directory preserving the file date.
voidcopyFileToDirectory(File srcFile, File destDir, boolean preserveFileDate)
Copies a file to a directory optionally preserving the file date.
voidcopyURLToFile(URL source, File destination)
Copies bytes from the URL source to a file destination.
voiddeleteDirectory(File directory)
Deletes a directory recursively.
booleandeleteQuietly(File file)
Deletes a file, never throwing an exception.
voidforceDelete(File file)
Deletes a file.
voidforceDeleteOnExit(File file)
Schedules a file to be deleted when JVM exits.
voidforceMkdir(File directory)
Makes a directory, including any necessary but nonexistent parent directories.
booleanisFileNewer(File file, File reference)
Tests if the specified File is newer than the reference File.
booleanisFileNewer(File file, Date date)
Tests if the specified File is newer than the specified Date.
booleanisFileNewer(File file, long timeMillis)
Tests if the specified File is newer than the specified time reference.
booleanisFileOlder(File file, File reference)
Tests if the specified File is older than the reference File.
booleanisFileOlder(File file, Date date)
Tests if the specified File is older than the specified Date.
booleanisFileOlder(File file, long timeMillis)
Tests if the specified File is older than the specified time reference.
IteratoriterateFiles(File directory, IOFileFilter fileFilter, IOFileFilter dirFilter)
Allows iteration over the files in given directory (and optionally its subdirectories).
IteratoriterateFiles(File directory, String[] extensions, boolean recursive)
Allows iteration over the files in a given directory (and optionally its subdirectories) which match an array of extensions.
LineIteratorlineIterator(File file, String encoding)
Returns an Iterator for the lines in a File.
LineIteratorlineIterator(File file)
Returns an Iterator for the lines in a File using the default encoding for the VM.
CollectionlistFiles(File directory, IOFileFilter fileFilter, IOFileFilter dirFilter)
Finds files within a given directory (and optionally its subdirectories).
CollectionlistFiles(File directory, String[] extensions, boolean recursive)
Finds files within a given directory (and optionally its subdirectories) which match an array of extensions.
voidmoveDirectory(File srcDir, File destDir)
Moves a directory.
voidmoveDirectoryToDirectory(File src, File destDir, boolean createDestDir)
Moves a directory to another directory.
voidmoveFile(File srcFile, File destFile)
Moves a file.
voidmoveFileToDirectory(File srcFile, File destDir, boolean createDestDir)
Moves a file to a directory.
voidmoveToDirectory(File src, File destDir, boolean createDestDir)
Moves a file or directory to the destination directory.
FileInputStreamopenInputStream(File file)
Opens a FileInputStream for the specified file, providing better error messages than simply calling new FileInputStream(file).
FileOutputStreamopenOutputStream(File file)
Opens a FileOutputStream for the specified file, checking and creating the parent directory if it does not exist.
byte[]readFileToByteArray(File file)
Reads the contents of a file into a byte array.
StringreadFileToString(File file)
Reads the contents of a file into a String using the default encoding for the VM.
StringreadFileToString(File file, String encoding)
Reads the contents of a file into a String.
ListreadLines(File file)
Reads the contents of a file line by line to a List of Strings using the default encoding for the VM.
ListreadLines(File file, String encoding)
Reads the contents of a file line by line to a List of Strings.
longsizeOfDirectory(File directory)
Counts the size of a directory recursively (sum of the length of all files).
FiletoFile(URL url)
Convert from a URL to a File.
voidtouch(File file)
Implements the same behaviour as the "touch" utility on Unix.
URL[]toURLs(File[] files)
Converts each of an array of File to a URL.
booleanwaitFor(File file, int seconds)
Waits for NFS to propagate a file creation, imposing a timeout.
voidwriteByteArrayToFile(File file, byte[] data)
Writes a byte array to a file creating the file if it does not exist.
voidwriteLines(File file, Collection lines)
Writes the toString() value of each item in a collection to the specified File line by line.
voidwriteLines(File file, String encoding, Collection lines)
Writes the toString() value of each item in a collection to the specified File line by line.
voidwriteLines(File file, Collection lines, String lineEnding)
Writes the toString() value of each item in a collection to the specified File line by line.
voidwriteLines(File file, String encoding, Collection lines, String lineEnding)
Writes the toString() value of each item in a collection to the specified File line by line.
voidwriteStringToFile(File file, String data, String encoding)
Writes a String to a file creating the file if it does not exist.
voidwriteStringToFile(File file, String data)
Writes a String to a file creating the file if it does not exist using the default encoding for the VM.