Example usage for Java org.apache.commons.io FileUtils fields, constructors, methods, implement or subclass
The text is from its open source code.
long | ONE_KB The number of bytes in a kilobyte. |
long | ONE_MB The number of bytes in a megabyte. |
long | ONE_GB The number of bytes in a gigabyte. |
File[] | EMPTY_FILE_ARRAY An empty array of type File . |
FileUtils() Instances should NOT be constructed in standard programming. |
String | byteCountToDisplaySize(long size) Returns a human-readable version of the file size, where the input represents a specific number of bytes. |
Checksum | checksum(File file, Checksum checksum) Computes the checksum of a file using the specified checksum object. |
long | checksumCRC32(File file) Computes the checksum of a file using the CRC32 checksum routine. |
void | cleanDirectory(File directory) Cleans a directory without deleting it. |
boolean | contentEquals(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. |
void | copyDirectory(File srcDir, File destDir) Copies a whole directory to a new location preserving the file dates. |
void | copyDirectory(File srcDir, File destDir, boolean preserveFileDate) Copies a whole directory to a new location. |
void | copyDirectory(File srcDir, File destDir, FileFilter filter) Copies a filtered directory to a new location preserving the file dates. |
void | copyDirectory(File srcDir, File destDir, FileFilter filter, boolean preserveFileDate) Copies a filtered directory to a new location. |
void | copyDirectoryToDirectory(File srcDir, File destDir) Copies a directory to within another directory preserving the file dates. |
void | copyFile(File srcFile, File destFile) Copies a file to a new location preserving the file date. |
void | copyFile(File srcFile, File destFile, boolean preserveFileDate) Copies a file to a new location. |
void | copyFileToDirectory(File srcFile, File destDir) Copies a file to a directory preserving the file date. |
void | copyFileToDirectory(File srcFile, File destDir, boolean preserveFileDate) Copies a file to a directory optionally preserving the file date. |
void | copyURLToFile(URL source, File destination) Copies bytes from the URL source to a file destination . |
void | deleteDirectory(File directory) Deletes a directory recursively. |
boolean | deleteQuietly(File file) Deletes a file, never throwing an exception. |
void | forceDelete(File file) Deletes a file. |
void | forceDeleteOnExit(File file) Schedules a file to be deleted when JVM exits. |
void | forceMkdir(File directory) Makes a directory, including any necessary but nonexistent parent directories. |
boolean | isFileNewer(File file, File reference) Tests if the specified File is newer than the reference File . |
boolean | isFileNewer(File file, Date date) Tests if the specified File is newer than the specified Date . |
boolean | isFileNewer(File file, long timeMillis) Tests if the specified File is newer than the specified time reference. |
boolean | isFileOlder(File file, File reference) Tests if the specified File is older than the reference File . |
boolean | isFileOlder(File file, Date date) Tests if the specified File is older than the specified Date . |
boolean | isFileOlder(File file, long timeMillis) Tests if the specified File is older than the specified time reference. |
Iterator | iterateFiles(File directory, IOFileFilter fileFilter, IOFileFilter dirFilter) Allows iteration over the files in given directory (and optionally its subdirectories). |
Iterator | iterateFiles(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. |
LineIterator | lineIterator(File file, String encoding) Returns an Iterator for the lines in a File . |
LineIterator | lineIterator(File file) Returns an Iterator for the lines in a File using the default encoding for the VM. |
Collection | listFiles(File directory, IOFileFilter fileFilter, IOFileFilter dirFilter) Finds files within a given directory (and optionally its subdirectories). |
Collection | listFiles(File directory, String[] extensions, boolean recursive) Finds files within a given directory (and optionally its subdirectories) which match an array of extensions. |
void | moveDirectory(File srcDir, File destDir) Moves a directory. |
void | moveDirectoryToDirectory(File src, File destDir, boolean createDestDir) Moves a directory to another directory. |
void | moveFile(File srcFile, File destFile) Moves a file. |
void | moveFileToDirectory(File srcFile, File destDir, boolean createDestDir) Moves a file to a directory. |
void | moveToDirectory(File src, File destDir, boolean createDestDir) Moves a file or directory to the destination directory. |
FileInputStream | openInputStream(File file) Opens a FileInputStream for the specified file, providing better error messages than simply calling new FileInputStream(file) . |
FileOutputStream | openOutputStream(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. |
String | readFileToString(File file) Reads the contents of a file into a String using the default encoding for the VM. |
String | readFileToString(File file, String encoding) Reads the contents of a file into a String. |
List | readLines(File file) Reads the contents of a file line by line to a List of Strings using the default encoding for the VM. |
List | readLines(File file, String encoding) Reads the contents of a file line by line to a List of Strings. |
long | sizeOfDirectory(File directory) Counts the size of a directory recursively (sum of the length of all files). |
File | toFile(URL url) Convert from a URL to a File . |
void | touch(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 . |
boolean | waitFor(File file, int seconds) Waits for NFS to propagate a file creation, imposing a timeout. |
void | writeByteArrayToFile(File file, byte[] data) Writes a byte array to a file creating the file if it does not exist. |
void | writeLines(File file, Collection lines) Writes the toString() value of each item in a collection to the specified File line by line. |
void | writeLines(File file, String encoding, Collection lines) Writes the toString() value of each item in a collection to the specified File line by line. |
void | writeLines(File file, Collection lines, String lineEnding) Writes the toString() value of each item in a collection to the specified File line by line. |
void | writeLines(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. |
void | writeStringToFile(File file, String data, String encoding) Writes a String to a file creating the file if it does not exist. |
void | writeStringToFile(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. |