Class CopyFile
java.lang.Object
io.github.raghultech.openloom.fs.CopyFile
================================================================
📄 CopyFile - Internal File Copy Utility
================================================================
Overview: Internal utility class used by OpenLoom to copy a single file from a source path to a target path. Supports preserving file attributes and optionally replacing existing files.
Important: This is a protected/internal class.
End-users should not use this class directly. To copy files,
use the FileManager APIs from OpenLoom:
OpenLoom loom = new OpenLoom();
loom.file().copyFile(Paths.get("C:/source.txt"), Paths.get("C:/target.txt"), true);
Key features:
- ✅ Copies files safely and efficiently
- âš¡ Preserves basic file attributes such as last modified time
- 🔄 Supports replaceExisting flag to overwrite files
- 🧠Automatically resolves target path conflicts
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcopyInternal(Path source, Path target, boolean replaceExisting) Copy a file from source to target.
-
Constructor Details
-
CopyFile
public CopyFile()
-
-
Method Details
-
copyInternal
Copy a file from source to target.This method handles file validation, resolves the final target path, preserves file attributes, and optionally replaces existing files.
Important behavior:
- If
replaceExistingis true, the target file is overwritten. - Throws
OpenLoomFileExceptionfor validation or I/O errors.
Note: This method is protected and intended to be used only through OpenLoom's
FileManagerclass.- Parameters:
source- the source file to copytarget- the target file pathreplaceExisting- whether to replace the target file if it exists- Throws:
OpenLoomFileException- if an I/O error occurs or file validation fails
- If
-