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