Object FileUtilities.Companion

  • All Implemented Interfaces:

    
    public class FileUtilities.Companion
    
                        

    File-type detection and the platform's path separator.

    • Constructor Detail

    • Method Detail

      • replaceFile

         final Boolean replaceFile(File sourceFile, File destinationFile)

        Move a file from source to destination, and replace the destination file if it exists.

        destinationFile — The destination file to be replaced by the source file. Returns returns true if the file was successfully replaced.

      • unzipArchive

         final Unit unzipArchive(String zipFile, String destinationDirectory)

        Unzips the downloaded modpack ZIP-archive to the specified directory.

        zipFile — The path to the ZIP-archive which we want to unzip. destinationDirectory — The directory into which the ZIP-archive will be unzipped into.

      • checkFileType

         final FileType checkFileType(String file)

        Check the given file for its type, whether it is a regular file, a Windows link or a UNIX symlink.

      • checkFileType

         final FileType checkFileType(File file)

        Check the given file for its type, whether it is a regular file, a Windows link or a UNIX symlink.

      • isLink

         final Boolean isLink(String file)

        Check if the given file is a UNIX symlink or Windows lnk.

      • isLink

         final Boolean isLink(File file)

        Check if the given file is a UNIX symlink or Windows lnk.

      • resolveLink

         final String resolveLink(String link)

        Resolve a given link/symlink to its source.

        link — The link you want to resolve. Returns path to the source of the link. If the specified file is not a link, the path to the passed file is returned.

      • resolveLink

         final String resolveLink(File link)

        Resolve a given link/symlink to its source.

        link — The link you want to resolve. Returns path to the source of the link. If the specified file is not a link, the path to the passed file is returned.

      • isReadWritePermissionSet

         final Boolean isReadWritePermissionSet(Path fileOrDirectory)

        Check the given file or directory for read- and write-permission.

        Returns true if both read- and write-permissions are set.

      • isReadWritePermissionSet

         final Boolean isReadWritePermissionSet(String fileOrDirectory)

        Check the given file or directory for read- and write-permission.

        Returns true if both read- and write-permissions are set.

      • isReadWritePermissionSet

         final Boolean isReadWritePermissionSet(File fileOrDirectory)

        Check the given file or directory for read- and write-permission.

        Returns true if both read- and write-permissions are set.

      • isReadPermissionSet

         final Boolean isReadPermissionSet(Path fileOrDirectory)

        Check the given file or directory for read-permission.

        Returns true if read-permissions are set.

      • isReadPermissionSet

         final Boolean isReadPermissionSet(String fileOrDirectory)

        Check the given file or directory for read-permission.

        Returns true if read-permissions are set.

      • isReadPermissionSet

         final Boolean isReadPermissionSet(File fileOrDirectory)

        Check the given file or directory for read-permission.

        Returns true if read-permissions are set.

      • isWritePermissionSet

         final Boolean isWritePermissionSet(Path fileOrDirectory)

        Check the given file or directory for write-permission.

        Returns true if write-permissions are set.

      • isWritePermissionSet

         final Boolean isWritePermissionSet(String fileOrDirectory)

        Check the given file or directory for write-permission.

        Returns true if write-permissions are set.

      • isWritePermissionSet

         final Boolean isWritePermissionSet(File fileOrDirectory)

        Check the given file or directory for write-permission.

        Returns true if write-permissions are set.

      • openFolder

         final Unit openFolder(File folder)

        Open the specified folder in the file explorer.

      • openFile

         final Unit openFile(File fileToOpen)

        Open the specified file in an editor.