Object FileUtilities.Companion
-
- All Implemented Interfaces:
public class FileUtilities.Companion
-
-
Field Summary
Fields Modifier and Type Field Description public final static FileUtilities.CompanionINSTANCE
-
Method Summary
Modifier and Type Method Description final BooleanreplaceFile(File sourceFile, File destinationFile)Move a file from source to destination, and replace the destination file if it exists. final UnitunzipArchive(String zipFile, String destinationDirectory)Unzips the downloaded modpack ZIP-archive to the specified directory. final FileTypecheckFileType(String file)Check the given file for its type, whether it is a regular file, a Windows link or a UNIX symlink. final FileTypecheckFileType(File file)Check the given file for its type, whether it is a regular file, a Windows link or a UNIX symlink. final BooleanisLink(String file)Check if the given file is a UNIX symlink or Windows lnk. final BooleanisLink(File file)Check if the given file is a UNIX symlink or Windows lnk. final StringresolveLink(String link)Resolve a given link/symlink to its source. final StringresolveLink(File link)Resolve a given link/symlink to its source. final BooleanisReadWritePermissionSet(Path fileOrDirectory)Check the given file or directory for read- and write-permission. final BooleanisReadWritePermissionSet(String fileOrDirectory)Check the given file or directory for read- and write-permission. final BooleanisReadWritePermissionSet(File fileOrDirectory)Check the given file or directory for read- and write-permission. final BooleanisReadPermissionSet(Path fileOrDirectory)Check the given file or directory for read-permission. final BooleanisReadPermissionSet(String fileOrDirectory)Check the given file or directory for read-permission. final BooleanisReadPermissionSet(File fileOrDirectory)Check the given file or directory for read-permission. final BooleanisWritePermissionSet(Path fileOrDirectory)Check the given file or directory for write-permission. final BooleanisWritePermissionSet(String fileOrDirectory)Check the given file or directory for write-permission. final BooleanisWritePermissionSet(File fileOrDirectory)Check the given file or directory for write-permission. final UnitopenFolder(String folder)Open the specified folder in the file explorer. final UnitopenFolder(File folder)Open the specified folder in the file explorer. final UnitopenFile(String fileToOpen)Open the specified file in an editor. final UnitopenFile(File fileToOpen)Open the specified file in an editor. final UnitdeleteMultiple(File files)Delete multiple files quietly. -
-
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.
- Parameters:
sourceFile- The source file.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.
- Parameters:
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.
- Parameters:
file- The file to check- Returns:
The type of the given file. Either FileType.FILE, FileType.LINK or FileType.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.
- Parameters:
file- The file to check- Returns:
The type of the given file. Either FileType.FILE, FileType.LINK or FileType.SYMLINK
-
isLink
final Boolean isLink(String file)
Check if the given file is a UNIX symlink or Windows lnk.
- Parameters:
file- The file to check.- Returns:
trueif 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.
- Parameters:
file- The file to check.- Returns:
trueif the given file is a UNIX symlink or Windows lnk.
-
resolveLink
final String resolveLink(String link)
Resolve a given link/symlink to its source.
- Parameters:
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.
- Parameters:
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.
- Parameters:
fileOrDirectory- File or directory.- Returns:
trueif both read- and write-permissions are set.
-
isReadWritePermissionSet
final Boolean isReadWritePermissionSet(String fileOrDirectory)
Check the given file or directory for read- and write-permission.
- Parameters:
fileOrDirectory- File or directory.- Returns:
trueif both read- and write-permissions are set.
-
isReadWritePermissionSet
final Boolean isReadWritePermissionSet(File fileOrDirectory)
Check the given file or directory for read- and write-permission.
- Parameters:
fileOrDirectory- File or directory.- Returns:
trueif both read- and write-permissions are set.
-
isReadPermissionSet
final Boolean isReadPermissionSet(Path fileOrDirectory)
Check the given file or directory for read-permission.
- Parameters:
fileOrDirectory- File or directory.- Returns:
trueif read-permissions are set.
-
isReadPermissionSet
final Boolean isReadPermissionSet(String fileOrDirectory)
Check the given file or directory for read-permission.
- Parameters:
fileOrDirectory- File or directory.- Returns:
trueif read-permissions are set.
-
isReadPermissionSet
final Boolean isReadPermissionSet(File fileOrDirectory)
Check the given file or directory for read-permission.
- Parameters:
fileOrDirectory- File or directory.- Returns:
trueif read-permissions are set.
-
isWritePermissionSet
final Boolean isWritePermissionSet(Path fileOrDirectory)
Check the given file or directory for write-permission.
- Parameters:
fileOrDirectory- File or directory.- Returns:
trueif write-permissions are set.
-
isWritePermissionSet
final Boolean isWritePermissionSet(String fileOrDirectory)
Check the given file or directory for write-permission.
- Parameters:
fileOrDirectory- File or directory.- Returns:
trueif write-permissions are set.
-
isWritePermissionSet
final Boolean isWritePermissionSet(File fileOrDirectory)
Check the given file or directory for write-permission.
- Parameters:
fileOrDirectory- File or directory.- Returns:
trueif write-permissions are set.
-
openFolder
final Unit openFolder(String folder)
Open the specified folder in the file explorer.
- Parameters:
folder- The folder to open.
-
openFolder
final Unit openFolder(File folder)
Open the specified folder in the file explorer.
- Parameters:
folder- The folder to open.
-
openFile
final Unit openFile(String fileToOpen)
Open the specified file in an editor.
- Parameters:
fileToOpen- The file to open.
-
openFile
final Unit openFile(File fileToOpen)
Open the specified file in an editor.
- Parameters:
fileToOpen- The file to open.
-
deleteMultiple
final Unit deleteMultiple(File files)
Delete multiple files quietly.
-
-
-
-