Class FileUtility
java.lang.Object
org.tasktide.mutex.utils.FileUtility
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckIfWritable(Path path) Checks whether provided path is writablestatic booleancreateDirectory(Path path) Create directory if not already existing, masking any error under booleanstatic booleanDeletes filestatic StringgetBaseName(String filePath) Get base file name for provided filepath using Paths APIstatic booleanCreates filestatic voidrecursiveDelete(Path path) Recursively deletes folder contentsstatic booleanreleaseLock(Path path, FileChannel fileChannel, FileLock fileLock) Releases OS file lockstatic booleantryLock(Path path, FileChannel fileChannel, FileLock fileLock) Puts OS file lock on path
-
Constructor Details
-
FileUtility
public FileUtility()
-
-
Method Details
-
getBaseName
-
recursiveDelete
Recursively deletes folder contents- Parameters:
path-- Throws:
IOException
-
makeFile
-
dropFile
-
tryLock
public static boolean tryLock(Path path, FileChannel fileChannel, FileLock fileLock) throws IOException Puts OS file lock on path- Parameters:
path-fileChannel-fileLock-- Returns:
- boolean
- Throws:
IOException
-
releaseLock
Releases OS file lock- Parameters:
path-fileChannel-fileLock-- Returns:
- boolean
-
checkIfWritable
Checks whether provided path is writable- Parameters:
path-- Returns:
- boolean
-
createDirectory
Create directory if not already existing, masking any error under boolean- Parameters:
path-- Returns:
- boolean
-