public final class FS
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
private |
FS() |
Modifier and Type | Method and Description |
---|---|
static void |
cleanDirectory(java.io.File dir)
Delete the contents of a directory and all contents under it, leaving the directory itself still in existance.
|
static void |
cleanDirectory(java.nio.file.Path dir)
Delete the contents of a directory and all contents under it, leaving the directory itself still in existance.
|
static void |
delete(java.io.File path)
Delete a file or a directory.
|
static void |
delete(java.nio.file.Path path)
Delete a file or a directory.
|
static void |
deleteDir(java.nio.file.Path path)
Delete a directory.
|
static void |
deleteDirectory(java.io.File dir)
Delete a directory and all contents under it.
|
static void |
deleteDirectory(java.nio.file.Path dir)
Delete a directory and all contents under it.
|
static void |
deleteFile(java.io.File path)
Delete a file.
|
static void |
deleteFile(java.nio.file.Path path)
Delete a file.
|
static void |
ensureDeleted(java.io.File dir)
Ensure the provided directory does not exist, delete it if present
|
static void |
ensureDeleted(java.nio.file.Path dir)
Ensure the provided directory does not exist, delete it if present
|
static void |
ensureDirExists(java.io.File dir)
Ensure that directory exists, create it if not present.
|
static void |
ensureDirExists(java.nio.file.Path dir)
Ensure that directory exists, create it if not present.
|
static void |
ensureEmpty(java.io.File dir)
Ensure the provided directory exists, and contains no content (empty)
|
static void |
ensureEmpty(java.nio.file.Path dir)
Ensure the provided directory exists, and contains no content (empty)
|
static void |
ensureEmpty(TestingDir testingdir)
Ensure the provided directory exists, and contains no content (empty)
|
protected static boolean |
isTestingDir(java.io.File dir)
Internal class used to detect if the directory is a valid testing directory.
|
protected static boolean |
isTestingDir(java.nio.file.Path dir)
Internal class used to detect if the directory is a valid testing directory.
|
private static void |
recursiveDeleteDir(java.nio.file.Path path) |
static void |
touch(java.io.File file)
Create an empty file at the location.
|
static void |
touch(java.nio.file.Path file)
Create an empty file at the location.
|
public static void delete(java.nio.file.Path path)
Note: safety mechanism only allows delete within the MavenTestingUtils.getTargetTestingDir()
directory.
path
- the file or directory to delete.public static void delete(java.io.File path)
Note: safety mechanism only allows delete within the MavenTestingUtils.getTargetTestingDir()
directory.
path
- the file or directory to delete.public static void deleteDirectory(java.io.File dir)
Note: safety mechanism only allows delete directory within the MavenTestingUtils.getTargetTestingDir()
directory.
dir
- the directory to delete.public static void deleteDirectory(java.nio.file.Path dir)
Note: safety mechanism only allows delete directory within the MavenTestingUtils.getTargetTestingDir()
directory.
dir
- the directory to delete.public static void deleteFile(java.io.File path)
Note: safety mechanism only allows delete file within the MavenTestingUtils.getTargetTestingDir()
directory.
path
- the path to delete.public static void deleteFile(java.nio.file.Path path)
Note: safety mechanism only allows delete file within the MavenTestingUtils.getTargetTestingDir()
directory.
path
- the path to delete.public static void deleteDir(java.nio.file.Path path)
Note: safety mechanism only allows delete file within the MavenTestingUtils.getTargetTestingDir()
directory.
path
- the path to delete.private static void recursiveDeleteDir(java.nio.file.Path path)
public static void cleanDirectory(java.io.File dir)
Note: safety mechanism only allows clean directory within the MavenTestingUtils.getTargetTestingDir()
directory.
dir
- the directory to delete.public static void cleanDirectory(java.nio.file.Path dir)
Note: safety mechanism only allows clean directory within the MavenTestingUtils.getTargetTestingDir()
directory.
dir
- the directory to delete.public static void ensureEmpty(java.io.File dir)
dir
- the dir to check.public static void ensureEmpty(java.nio.file.Path dir)
dir
- the dir to check.public static void ensureEmpty(TestingDir testingdir)
testingdir
- the dir to check.public static void ensureDeleted(java.io.File dir)
dir
- the dir to checkpublic static void ensureDeleted(java.nio.file.Path dir)
dir
- the dir to checkpublic static void ensureDirExists(java.io.File dir)
dir
- the dir to check.public static void ensureDirExists(java.nio.file.Path dir)
dir
- the dir to check.protected static boolean isTestingDir(java.io.File dir)
Used as part of the validation on what directories are safe to delete from.
dir
- the dir to checkprotected static boolean isTestingDir(java.nio.file.Path dir)
Used as part of the validation on what directories are safe to delete from.
dir
- the dir to checkpublic static void touch(java.io.File file) throws java.io.IOException
file
- the file to create or update the timestamp of.java.io.IOException
- if unable to create the new file.public static void touch(java.nio.file.Path file) throws java.io.IOException
file
- the file to create or update the timestamp of.java.io.IOException
- if unable to create the new file.