Class FileUtil
java.lang.Object
wtf.ranked.hytale.server.runner.util.FileUtil
Utility class for file and directory operations.
Provides helper methods for extracting archives and managing the cleanup of server files and directories.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteFile(@NonNull File file) Safely deletes a file or directory recursively.voidunpackZipFile(@NonNull File zip, @NonNull File destinationPath) Extracts all contents of a ZIP archive to the specified destination and subsequently deletes the source archive file.
-
Constructor Details
-
FileUtil
public FileUtil()
-
-
Method Details
-
unpackZipFile
Extracts all contents of a ZIP archive to the specified destination and subsequently deletes the source archive file.- Parameters:
zip- the source ZIP archive file to extractdestinationPath- the target directory where contents will be extracted- Throws:
RuntimeException- if an I/O error occurs during extraction or deletion
-
deleteFile
Safely deletes a file or directory recursively.If the specified file or directory does not exist, no action is taken. Otherwise, it forces the deletion of the target and its contents.
- Parameters:
file- the file or directory to delete
-