@ThreadSafe public final class FileOperations extends Object
| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEFAULT_EXCEPTION_ON_DELETE_ROOT
The default value for warning if we're about to delete the root directory.
|
| Modifier and Type | Method and Description |
|---|---|
static FileIOError |
copyDirRecursive(File aSourceDir,
File aTargetDir)
Copy a directory including all child objects.
|
static FileIOError |
copyFile(File aSourceFile,
File aTargetFile)
Copies the source file to the target file.
|
static FileIOError |
createDir(File aDir)
Create a new directory.
|
static FileIOError |
createDirIfNotExisting(File aDir)
Create a new directory if it does not exist.
|
static FileIOError |
createDirRecursive(File aDir)
Create a new directory.
|
static FileIOError |
createDirRecursiveIfNotExisting(File aDir)
Create a new directory if it does not exist.
|
static FileIOError |
deleteDir(File aDir)
Delete an existing directory.
|
static FileIOError |
deleteDirIfExisting(File aDir)
Delete an existing directory if it is existing.
|
static FileIOError |
deleteDirRecursive(File aDir)
Delete an existing directory including all child objects.
|
static FileIOError |
deleteDirRecursiveIfExisting(File aDir)
Delete an existing directory including all child objects if it is existing.
|
static FileIOError |
deleteFile(File aFile)
Delete an existing file.
|
static FileIOError |
deleteFileIfExisting(File aFile)
Delete a file if it is existing.
|
static boolean |
isExceptionOnDeleteRoot() |
static FileIOError |
renameDir(File aSourceDir,
File aTargetDir)
Rename a directory.
|
static FileIOError |
renameFile(File aSourceFile,
File aTargetFile)
Rename a file.
|
static void |
setExceptionOnDeleteRoot(boolean bExceptionOnDeleteRoot) |
public static final boolean DEFAULT_EXCEPTION_ON_DELETE_ROOT
public static boolean isExceptionOnDeleteRoot()
public static void setExceptionOnDeleteRoot(boolean bExceptionOnDeleteRoot)
@Nonnull public static FileIOError createDir(@Nonnull File aDir)
aDir - The directory to be created. May not be null.null error code.@Nonnull public static FileIOError createDirIfNotExisting(@Nonnull File aDir)
aDir - The directory to be created if it does not exist. May not be
null.null error code.@Nonnull public static FileIOError createDirRecursive(@Nonnull File aDir)
aDir - The directory to be created. May not be null.null error code.@Nonnull public static FileIOError createDirRecursiveIfNotExisting(@Nonnull File aDir)
aDir - The directory to be created if it does not exist. May not be
null.null error code.createDirRecursive(File)@Nonnull public static FileIOError deleteDir(@Nonnull File aDir)
aDir - The directory to be deleted. May not be null.null error code.@Nonnull public static FileIOError deleteDirIfExisting(@Nonnull File aDir)
aDir - The directory to be deleted. May not be null.null error code.deleteDir(File)@Nonnull public static FileIOError deleteDirRecursive(@Nonnull File aDir)
aDir - The directory to be deleted. May not be null.null error code.@Nonnull public static FileIOError deleteDirRecursiveIfExisting(@Nonnull File aDir)
aDir - The directory to be deleted. May not be null.null error code.@Nonnull public static FileIOError deleteFile(@Nonnull File aFile)
aFile - The file to be deleted. May not be null.null error code.@Nonnull public static FileIOError deleteFileIfExisting(@Nonnull File aFile)
aFile - The file to be deleted. May not be null.null error code.@Nonnull public static FileIOError renameFile(@Nonnull File aSourceFile, @Nonnull File aTargetFile)
aSourceFile - The original file name. May not be null.aTargetFile - The destination file name. May not be null.null error code.@Nonnull public static FileIOError renameDir(@Nonnull File aSourceDir, @Nonnull File aTargetDir)
aSourceDir - The original directory name. May not be null.aTargetDir - The destination directory name. May not be null.null error code.@Nonnull public static FileIOError copyFile(@Nonnull File aSourceFile, @Nonnull File aTargetFile)
aSourceFile - The source file to use. May not be null. Needs to be an
existing file.aTargetFile - The destination files. May not be null and may not be
an existing file.null error code.@Nonnull public static FileIOError copyDirRecursive(@Nonnull File aSourceDir, @Nonnull File aTargetDir)
aSourceDir - The source directory to be copied. May not be null.aTargetDir - The destination directory where to be copied. This directory may not
be existing. May not be null.null error code.Copyright © 2014–2022 Philip Helger. All rights reserved.