public class SystemUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static OsType |
OS |
static OsArch |
OS_ARCH |
static OsArchType |
OS_ARCH_TYPE |
static String |
TMP_DIR |
| Constructor and Description |
|---|
SystemUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Path |
copyResourceToTemp(Class<?> clazz,
String relativePath)
Copies a source file to temp path as the resources are not accessible/executable
|
static boolean |
deleteDirectory(Path path)
Deletes silent a directory
|
static void |
killProcessByName(String name)
kills processes by name
|
static String |
readFile(Path path)
Reads in a whole file
|
static List<String> |
readFileLines(Path path)
Reads in a whole file
|
static boolean |
setFilePermissions(Path path,
PosixFilePermission... permissions)
Sets silent file permissions (PosixFilePermissions will be mapped to filePermissions as windows doesn't understand posix)
|
public static final String TMP_DIR
public static final OsType OS
public static final OsArch OS_ARCH
public static final OsArchType OS_ARCH_TYPE
public static boolean setFilePermissions(Path path, PosixFilePermission... permissions)
path - Path to set permissions onpermissions - permission list to set for the given Pathpublic static Path copyResourceToTemp(Class<?> clazz, String relativePath)
clazz - Caller class to find its resource / get its classloaderrelativePath - relative resource file pathpublic static String readFile(Path path)
path - Filepath to read frompublic static List<String> readFileLines(Path path)
path - Filepath to read frompublic static boolean deleteDirectory(Path path)
path - directory to deletepublic static void killProcessByName(String name)
name - name of the process to killCopyright © 2022. All rights reserved.