public class OSFunction
extends java.lang.Object
Constructor and Description |
---|
OSFunction() |
Modifier and Type | Method and Description |
---|---|
static void |
clearActiveProcesses()
Clear active processes, mainly to reduce memory consumption when were
done with them
|
static java.util.ArrayList<java.lang.String> |
filterProcesses(java.util.ArrayList<java.lang.String> processes,
java.lang.String filter)
Find processes matching the contents of filter
|
static java.util.ArrayList<java.lang.String> |
filterProcesses(java.lang.String filter)
Find processes matching the contents of filter
|
static java.lang.String |
findFile(java.lang.String fname,
java.lang.String... paths)
Find a specific file, requires a series of paths where it might be found
to be provided
|
static java.lang.String |
getActiveDesktop()
Get the name of the active desktop
|
static java.lang.String |
getAppSettingsPath(java.lang.String appname,
java.lang.String appseries)
Get a specified application's settings folder, if null return this
applications setting folder
|
static java.util.ArrayList<java.lang.String> |
getCachedProcesses()
Cached list of processes
|
static java.lang.String |
getCompositor()
Get the name of the compositor
|
static java.lang.String |
getFileSeparator()
Get file separator
|
static java.lang.String |
getGnome3Pref(java.lang.String schema,
java.lang.String key)
Get gnome 3 preference using schema name and key name
|
static java.lang.String |
getGsettingsPath()
Test if gsettings installed (Linux only)
|
static java.lang.String |
getKDEPref(java.lang.String group,
java.lang.String key,
java.lang.String def)
Get a kde preference string value using group name, key name and return
contents of def on failure
|
static java.lang.String |
getKDEProxyPath()
Test for KDE installed (Linux only)
|
static java.lang.String |
getLangCode()
Get default language iso code
|
static java.util.ArrayList<java.lang.String> |
getLiveProcesses()
Gets list of active system processes
|
static java.lang.String |
getOSArch()
Get OS architecture, convenience method
|
static java.lang.String |
getOSName()
Get OS name, convenience method
|
static java.lang.String |
getOSVersion()
Get OS version
|
static java.lang.String |
getOurProcessID()
Get process id
|
static java.lang.String |
getProcessID(java.lang.String process)
Get process id from a process
|
static java.util.ArrayList<java.lang.String> |
getProcessOutput(java.io.InputStream is)
Obtain all output of an executed process.
|
static java.lang.String |
getProcessResult(java.lang.Process aprocess)
Convenience method to get the first resultant output of an executed
process as a String
|
static java.lang.String |
getTempFolder(java.lang.String path)
Get users temp folder
|
static java.lang.String |
getUserName()
Get user name
|
static java.lang.String |
getUsersCurrentFolder()
Get users current folder
|
static java.lang.String |
getUsersDocFolder()
Get users documents folder (Windows only)
|
static java.lang.String |
getUserSettingsPath()
Get user settings path
|
static java.lang.String |
getUsersHomeFolder()
Get users home folder
|
static boolean |
isLinux()
Generic test for Linux platform
|
static boolean |
isMultipleInstance(java.lang.String appname)
Test to see if their are multiple instances of the this app running
|
static boolean |
isWin10()
Specific test for Win 10
|
static boolean |
isWin7()
Specific test for Win 7
|
static boolean |
isWin8()
Specific test for Win 8
|
static boolean |
isWindows()
Generic test for Windows platform
|
static boolean |
isWinXP()
Specific test for Win XP
|
static java.lang.String |
killProcess(java.lang.String pid)
Generic kill process with matching pid
|
static java.lang.Process |
launchProcess(java.lang.String... command)
Launch an external process with arguments
|
static void |
resetGnome3Pref(java.lang.String schema,
java.lang.String key)
Reset a gnome3 value to its default.
|
static void |
setFileHidden(java.lang.String filepath,
boolean hidden)
Set a files hidden status (Windows only)
|
static void |
setGnome3Pref(java.lang.String schema,
java.lang.String key,
boolean value)
Set a gnome 3 boolean value using schema name and key name
|
static void |
setGnome3Pref(java.lang.String schema,
java.lang.String key,
java.lang.String value)
Set a gnome 3 string value using schema name and key name
|
static void |
setKDEPref(java.lang.String group,
java.lang.String key,
boolean value)
Set a kde boolean preference value using group name, key name
|
static void |
setKDEPref(java.lang.String group,
java.lang.String key,
int value)
Set a kde integer preference value using group name, key name
|
static void |
setKDEPref(java.lang.String group,
java.lang.String key,
java.lang.String value)
Set a kde string preference value using group name, key name
|
public static java.lang.String getOurProcessID()
public static java.lang.String getProcessID(java.lang.String process)
process
- public static java.lang.String getOSVersion()
public static java.lang.String getUserName()
public static java.lang.String getUsersHomeFolder()
public static java.lang.String getFileSeparator()
public static java.lang.String getUsersDocFolder()
public static java.lang.String getUserSettingsPath()
public static java.lang.String getAppSettingsPath(java.lang.String appname, java.lang.String appseries)
appname
- Application settings folder nameappseries
- Application series (optional)public static java.lang.String getUsersCurrentFolder()
public static java.lang.String getTempFolder(java.lang.String path)
path
- public static java.lang.String getOSName()
public static java.lang.String getOSArch()
public static boolean isWindows()
public static boolean isWin7()
public static boolean isWin8()
public static boolean isWin10()
public static boolean isWinXP()
public static boolean isLinux()
public static java.lang.String findFile(java.lang.String fname, java.lang.String... paths)
fname
- paths
- public static boolean isMultipleInstance(java.lang.String appname)
appname
- public static java.util.ArrayList<java.lang.String> getCachedProcesses()
public static java.util.ArrayList<java.lang.String> filterProcesses(java.util.ArrayList<java.lang.String> processes, java.lang.String filter)
processes
- filter
- public static java.util.ArrayList<java.lang.String> filterProcesses(java.lang.String filter)
filter
- public static java.lang.String killProcess(java.lang.String pid)
pid
- public static void setFileHidden(java.lang.String filepath, boolean hidden)
filepath
- Path to file includes filenamehidden
- True/Falsepublic static java.lang.String getGnome3Pref(java.lang.String schema, java.lang.String key)
schema
- key
- public static void setGnome3Pref(java.lang.String schema, java.lang.String key, boolean value)
schema
- key
- value
- public static void setGnome3Pref(java.lang.String schema, java.lang.String key, java.lang.String value)
schema
- key
- value
- public static void resetGnome3Pref(java.lang.String schema, java.lang.String key)
schema
- key
- public static java.lang.String getKDEPref(java.lang.String group, java.lang.String key, java.lang.String def)
group
- key
- def
- public static void setKDEPref(java.lang.String group, java.lang.String key, java.lang.String value)
group
- key
- value
- public static void setKDEPref(java.lang.String group, java.lang.String key, boolean value)
group
- key
- value
- public static void setKDEPref(java.lang.String group, java.lang.String key, int value)
group
- key
- value
- public static java.lang.String getKDEProxyPath()
public static java.lang.String getGsettingsPath()
public static java.lang.String getProcessResult(java.lang.Process aprocess)
aprocess
- public static java.util.ArrayList<java.lang.String> getProcessOutput(java.io.InputStream is)
is
- public static java.lang.Process launchProcess(java.lang.String... command)
command
- public static java.util.ArrayList<java.lang.String> getLiveProcesses()
public static java.lang.String getCompositor()
public static java.lang.String getActiveDesktop()
public static void clearActiveProcesses()
public static java.lang.String getLangCode()