Class FS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcleanDirectory(File dir) Deprecated, for removal: This API element is subject to removal in a future version.static voidcleanDirectory(Path dir) Delete the contents of a directory and all contents under it, leaving the directory itself still in existance.static voidDeprecated, for removal: This API element is subject to removal in a future version.use Path versiondelete(Path)static voidDelete a file or a directory.static voidDelete a directory.static voiddeleteDirectory(File dir) Deprecated, for removal: This API element is subject to removal in a future version.use Path versiondeleteDirectory(Path)static voiddeleteDirectory(Path dir) Delete a directory and all contents under it.static voiddeleteFile(File path) Deprecated, for removal: This API element is subject to removal in a future version.use Path versiondeleteFile(Path)static voiddeleteFile(Path path) Delete a file.static voidensureDeleted(File dir) Deprecated, for removal: This API element is subject to removal in a future version.use Path versionensureDeleted(Path)static voidensureDeleted(Path dir) Ensure the provided directory does not exist, delete it if presentstatic voidensureDirExists(File dir) Deprecated, for removal: This API element is subject to removal in a future version.use Path versionensureDirExists(Path)static voidensureDirExists(Path dir) Ensure that directory exists, create it if not present.static voidensureEmpty(File dir) Deprecated, for removal: This API element is subject to removal in a future version.use Path versionensureEmpty(Path)static voidensureEmpty(Path dir) Ensure the provided directory exists, and contains no content (empty)(package private) static booleanisTestingDir(File dir) Deprecated, for removal: This API element is subject to removal in a future version.use Path versionisTestingDir(Path)(package private) static booleanisTestingDir(Path dir) Internal class used to detect if the directory is a valid testing directory.private static voidrecursiveDeleteDir(Path path) static Stringseparators(String path) Convert path separators to the System path separators.static voidDeprecated, for removal: This API element is subject to removal in a future version.use Path versiontouch(Path)static voidCreate an empty file at the location.
-
Constructor Details
-
FS
private FS()
-
-
Method Details
-
delete
Delete a file or a directory.Note: safety mechanism only allows content to be deleted within the
MavenPaths.targetTests()directory.- Parameters:
path- the file or directory to delete.
-
delete
Deprecated, for removal: This API element is subject to removal in a future version.use Path versiondelete(Path)Delete a file or a directory.Note: safety mechanism only allows content to be deleted within the
MavenPaths.targetTests()directory.- Parameters:
path- the file or directory to delete.
-
deleteDirectory
Deprecated, for removal: This API element is subject to removal in a future version.use Path versiondeleteDirectory(Path)Delete a directory and all contents under it.Note: safety mechanism only allows content to be deleted within the
MavenPaths.targetTests()directory.- Parameters:
dir- the directory to delete.
-
deleteDirectory
Delete a directory and all contents under it.Note: safety mechanism only allows content to be deleted within the
MavenPaths.targetTests()directory.- Parameters:
dir- the directory to delete.
-
deleteFile
Deprecated, for removal: This API element is subject to removal in a future version.use Path versiondeleteFile(Path)Delete a file.Note: safety mechanism only allows content to be deleted within the
MavenPaths.targetTests()directory.- Parameters:
path- the path to delete.
-
deleteFile
Delete a file.Note: safety mechanism only allows content to be deleted within the
MavenPaths.targetTests()directory.- Parameters:
path- the path to delete.
-
deleteDir
Delete a directory. (only if it is empty)Note: safety mechanism only allows delete file within the
MavenPaths.targetTests()directory.- Parameters:
path- the path to delete.
-
recursiveDeleteDir
-
cleanDirectory
Deprecated, for removal: This API element is subject to removal in a future version.use Path versioncleanDirectory(Path)Delete the contents of a directory and all contents under it, leaving the directory itself still in existance.Note: safety mechanism only allows clean directory within the
MavenPaths.targetTests()directory.- Parameters:
dir- the directory to delete.
-
cleanDirectory
Delete the contents of a directory and all contents under it, leaving the directory itself still in existance.Note: safety mechanism only allows clean directory within the
MavenPaths.targetTests()directory.- Parameters:
dir- the directory to delete.
-
ensureEmpty
Deprecated, for removal: This API element is subject to removal in a future version.use Path versionensureEmpty(Path)Ensure the provided directory exists, and contains no content (empty)- Parameters:
dir- the dir to check.
-
ensureEmpty
Ensure the provided directory exists, and contains no content (empty)- Parameters:
dir- the dir to check.
-
ensureDeleted
Deprecated, for removal: This API element is subject to removal in a future version.use Path versionensureDeleted(Path)Ensure the provided directory does not exist, delete it if present- Parameters:
dir- the dir to check
-
ensureDeleted
Ensure the provided directory does not exist, delete it if present- Parameters:
dir- the dir to check
-
ensureDirExists
Deprecated, for removal: This API element is subject to removal in a future version.use Path versionensureDirExists(Path)Ensure that directory exists, create it if not present. Leave it alone if already there.- Parameters:
dir- the dir to check.
-
ensureDirExists
Ensure that directory exists, create it if not present. Leave it alone if already there.- Parameters:
dir- the dir to check.
-
isTestingDir
Deprecated, for removal: This API element is subject to removal in a future version.use Path versionisTestingDir(Path)Internal class used to detect if the directory is a valid testing directory.Used as part of the validation on what directories are safe to delete from.
- Parameters:
dir- the dir to check- Returns:
- true if provided directory is a testing directory
-
isTestingDir
Internal class used to detect if the directory is a valid testing directory.Used as part of the validation on what directories are safe to delete from.
- Parameters:
dir- the dir to check- Returns:
- true if provided directory is a testing directory
-
touch
Deprecated, for removal: This API element is subject to removal in a future version.use Path versiontouch(Path)Create an empty file at the location. If the file exists, just update the last modified timestamp.- Parameters:
file- the file to create or update the timestamp of.- Throws:
IOException- if unable to create the new file.
-
touch
Create an empty file at the location. If the file exists, just update the last modified timestamp.- Parameters:
file- the file to create or update the timestamp of.- Throws:
IOException- if unable to create the new file.
-
separators
Convert path separators to the System path separators.This helps ensure that the paths provided in the unit tests work equally as well on unix / osx / windows.
- Parameters:
path- the raw path to convert- Returns:
- the converted path
-
cleanDirectory(Path)