Class MoveFile

java.lang.Object
io.github.raghultech.openloom.fs.MoveFile

public class MoveFile extends Object
================================================================ 📄 MoveFile - File Move Utility ================================================================

Overview: Provides a safe and efficient method to move a single file from a source path to a target path. Supports optional replacement of existing files and uses atomic moves where possible.

Important: This class is protected and intended for internal usage. Users should access file move operations through FileManager:


 OpenLoom loom = new OpenLoom();
 loom.file().moveFile(Paths.get("C:/source.txt"), Paths.get("C:/target.txt"), true);
 

Key features:

  • ✅ Moves files safely using atomic operations
  • âš¡ Supports optional overwriting of existing files
  • 🧠 Resolves final target paths to avoid conflicts
  • 🔄 Wraps I/O errors in detailed OpenLoomFileException
  • Constructor Details

    • MoveFile

      public MoveFile()
  • Method Details

    • moveInternal

      protected void moveInternal(Path source, Path target, boolean replaceExisting)
      Moves a file from source to target.

      If replaceExisting is true, an existing target file will be replaced. Uses atomic moves where supported by the file system.

      Parameters:
      source - the source file to move
      target - the target location
      replaceExisting - whether to overwrite the target file if it exists
      Throws:
      OpenLoomFileException - if validation fails or an I/O error occurs