Class FileUtility

java.lang.Object
org.tasktide.mutex.utils.FileUtility

public class FileUtility extends Object
  • Constructor Details

    • FileUtility

      public FileUtility()
  • Method Details

    • getBaseName

      public static String getBaseName(String filePath)
      Get base file name for provided filepath using Paths API
      Parameters:
      filePath -
      Returns:
      String
    • recursiveDelete

      public static void recursiveDelete(Path path) throws IOException
      Recursively deletes folder contents
      Parameters:
      path -
      Throws:
      IOException
    • makeFile

      public static boolean makeFile(Path path)
      Creates file
      Parameters:
      path -
      Returns:
      boolean
    • dropFile

      public static boolean dropFile(Path path)
      Deletes file
      Parameters:
      path -
      Returns:
      boolean
    • 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

      public static boolean releaseLock(Path path, FileChannel fileChannel, FileLock fileLock)
      Releases OS file lock
      Parameters:
      path -
      fileChannel -
      fileLock -
      Returns:
      boolean
    • checkIfWritable

      public static boolean checkIfWritable(Path path)
      Checks whether provided path is writable
      Parameters:
      path -
      Returns:
      boolean
    • createDirectory

      public static boolean createDirectory(Path path)
      Create directory if not already existing, masking any error under boolean
      Parameters:
      path -
      Returns:
      boolean