Class FileUtils

java.lang.Object
utils.FileUtils

public class FileUtils extends Object
Utility class for file operations.
  • Constructor Details

    • FileUtils

      private FileUtils()
      Utility class — do not instantiate.
  • Method Details

    • retryFileOperation

      public static void retryFileOperation(FileOperation operation, int maxRetries) throws IOException
      Retries a file operation multiple times in case of transient failures.
      Parameters:
      operation - The file operation to execute.
      maxRetries - The maximum number of retries.
      Throws:
      IOException - If the operation fails after all retries.
    • verifyFileIntegrity

      public static boolean verifyFileIntegrity(Path source, Path target) throws IOException
      Verifies the integrity of a file by comparing its size before and after copying.
      Parameters:
      source - The source file path.
      target - The target file path.
      Returns:
      True if the file sizes match, false otherwise.
      Throws:
      IOException - If an I/O error occurs.