java.lang.Objectjwrapper.jwutils.JWGenericOS
public abstract class JWGenericOS
Utility methods for OS level interactions which are cross platform (Windows/Linux/Mac)
Constructor Summary | |
---|---|
JWGenericOS()
|
Method Summary | |
---|---|
abstract java.lang.String[] |
getAllConsoleUsers()
|
int |
getCurrentProcessID()
Get the process ID of this JVM |
java.lang.String |
getHostname()
|
static JWGenericOS |
getInstance()
|
java.lang.String |
getOSName()
Return the OS name - utility for getting accurate OS names even with older JVMs. |
java.lang.String |
getOSNameWithBitness()
Return the OS name with x86 for 32bit systems and x64 for 64bit systems |
java.lang.String |
getOSVersion()
Return the OS version |
static void |
setCurrentDirectory(java.io.File dir)
Change the current working directory for the entire JVM (warning - not guaranteed to be supported or work properly - use with caution) |
static java.lang.Process |
setReadableForAllUsers(java.io.File dir,
boolean recursive)
|
static void |
setReadableForAllUsersAndWait(java.io.File dir,
boolean recursive)
Recursively sets the file or folder to be accessible / modifiable for all users |
static java.lang.Process |
setWritableForAllUsers(java.io.File dir,
boolean recursive)
|
static void |
setWritableForAllUsersAndWait(java.io.File dir,
boolean recursive)
Recursively sets the file or folder to be accessible / modifiable for all users |
static boolean |
terminateProcess(int pid)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JWGenericOS()
Method Detail |
---|
public abstract java.lang.String[] getAllConsoleUsers()
public int getCurrentProcessID()
public java.lang.String getHostname()
public static JWGenericOS getInstance()
public java.lang.String getOSName()
public java.lang.String getOSNameWithBitness()
public java.lang.String getOSVersion()
public static void setCurrentDirectory(java.io.File dir) throws java.io.IOException
dir
-
java.io.IOException
public static java.lang.Process setReadableForAllUsers(java.io.File dir, boolean recursive) throws java.io.IOException
java.io.IOException
public static void setReadableForAllUsersAndWait(java.io.File dir, boolean recursive) throws java.io.IOException
dir
-
java.io.IOException
public static java.lang.Process setWritableForAllUsers(java.io.File dir, boolean recursive) throws java.io.IOException
java.io.IOException
public static void setWritableForAllUsersAndWait(java.io.File dir, boolean recursive) throws java.io.IOException
dir
-
java.io.IOException
public static boolean terminateProcess(int pid)