Package berlin.yuna.clu.logic
Class SystemUtil
java.lang.Object
berlin.yuna.clu.logic.SystemUtil
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final OsTypestatic final OsArchstatic final OsArchTypestatic final String -
Method Summary
Modifier and TypeMethodDescriptionstatic PathcopyResourceToTemp(Class<?> clazz, String relativePath) Copies a source file to temp path as the resources are not accessible/executablestatic booleandeleteDirectory(Path path) Deletes silent a directorystatic StringkillCommand(OsType os) static voidkillProcessByName(String name) kills processes by namestatic StringReads in a whole filereadFileLines(Path path) Reads in a whole filestatic booleansetFilePermissions(Path path, PosixFilePermission... permissions) Sets silent file permissions (PosixFilePermissions will be mapped to filePermissions as windows doesn't understand posix)
-
Field Details
-
TMP_DIR
-
OS
-
OS_ARCH
-
OS_ARCH_TYPE
-
-
Method Details
-
setFilePermissions
Sets silent file permissions (PosixFilePermissions will be mapped to filePermissions as windows doesn't understand posix)- Parameters:
path- Path to set permissions onpermissions- permission list to set for the given Path- Returns:
- true if no error occurred and if permissions are set successfully
-
copyResourceToTemp
Copies a source file to temp path as the resources are not accessible/executable- Parameters:
clazz- Caller class to find its resource / get its classloaderrelativePath- relative resource file path- Returns:
- temp path from copied file output
-
readFile
Reads in a whole file- Parameters:
path- Filepath to read from- Returns:
- File content
-
readFileLines
Reads in a whole file- Parameters:
path- Filepath to read from- Returns:
- File content line wise
-
deleteDirectory
Deletes silent a directory- Parameters:
path- directory to delete- Returns:
- false on exception and any deletion error
-
killProcessByName
kills processes by name- Parameters:
name- name of the process to kill
-
killCommand
-