public class FileUtils
extends java.lang.Object
FileUtils
Constructor and Description |
---|
FileUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
copyFileStreams(java.io.File fromFile,
java.io.File toFile)
Copy a file from one location to another, and set the modification time to match.
|
static boolean |
deleteDir(java.io.File dir)
Delete a directory recursively.
|
static void |
deleteDirOnExit(java.io.File dir)
Delete a directory recursively.
|
static void |
fileCopy(java.io.File src,
java.io.File dest,
boolean overwrite)
Copies file src to dest using nio.
|
static void |
fileRename(java.io.File file,
java.lang.String newPath)
Rename a file
|
static void |
fileRename(java.io.File file,
java.lang.String newPath,
java.lang.Class clazz)
Rename a file.
|
static void |
mkParentDirs(java.io.File file)
Create parent directory structure of a given file, if it doesn't already
exist.
|
public static void fileCopy(java.io.File src, java.io.File dest, boolean overwrite) throws java.io.IOException
src
- source filedest
- destination fileoverwrite
- true to overwrite if it already existsjava.io.IOException
- on io errorpublic static void copyFileStreams(java.io.File fromFile, java.io.File toFile) throws java.io.IOException
fromFile
- source filetoFile
- dest filejava.io.IOException
- on io errorpublic static boolean deleteDir(java.io.File dir)
dir
- Directory to deletepublic static void deleteDirOnExit(java.io.File dir)
dir
- Directory to deletepublic static void fileRename(java.io.File file, java.lang.String newPath, java.lang.Class clazz)
file
- File to renamenewPath
- Path for new file nameclazz
- Class associated with lockCoreException
- A CoreException is raised if any underlying I/O
operation fails.public static void fileRename(java.io.File file, java.lang.String newPath)
file
- File to renamenewPath
- Path for new file nameCoreException
- An CoreException is raised if any underlying I/O
operation fails.public static void mkParentDirs(java.io.File file) throws java.io.IOException
file
- File to create directories forjava.io.IOException
- if an I/O error occurs