Package com.tagtraum.core
Class OperatingSystem
- java.lang.Object
-
- com.tagtraum.core.OperatingSystem
-
public final class OperatingSystem extends Object
Operating System.- Author:
- Hendrik Schreiber
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
OperatingSystem.ExternalApplication
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Path
getDesktopDirectory()
static OperatingSystem.ExternalApplication[]
getExternalApplications(URL url)
Lists the available applications for the given URL.static String
getJavaRuntimeSupportVersion()
Version string for the JavaRuntimeSupportVersion.framework, available only on macOS.static Path
getLocalApplicationSupportDirectory()
Local app data folder.static String
getSystemAppearance()
static Path
getUsersMusicDirectory()
User's music folder.static boolean
is64Bit()
static boolean
isBigSur()
static boolean
isBigSurOrLater()
static boolean
isCatalina()
static boolean
isCatalinaOrLater()
static boolean
isElCapitan()
static boolean
isElCapitanOrLater()
static boolean
isHighSierra()
static boolean
isHighSierraOrLater()
static boolean
isI386()
static boolean
isLeopard()
static boolean
isLeopardOrLater()
static boolean
isLion()
static boolean
isLionOrLater()
static boolean
isMac()
static boolean
isMavericks()
static boolean
isMavericksOrLater()
static boolean
isMojave()
static boolean
isMojaveOrLater()
static boolean
isMountainLion()
static boolean
isMountainLionOrLater()
static boolean
isPowerPC()
static boolean
isSnowLeopard()
static boolean
isSnowLeopardOrLater()
static boolean
isVista()
static boolean
isVistaOrLater()
static boolean
isWin10()
static boolean
isWin10OrLater()
static boolean
isWin7()
static boolean
isWin7OrLater()
static boolean
isWin8()
static boolean
isWin8_1()
static boolean
isWin8_1OrLater()
static boolean
isWin8OrLater()
static boolean
isWindows()
static boolean
isXP()
static boolean
isXPOrLater()
static boolean
isYosemite()
static boolean
isYosemiteOrLater()
static boolean
moveToTrashIfPossible(Path file)
Tries to move a file to the trash.static void
openWithExternalApplication(URL url)
Opens the given URL in an external application, typically the OS's default application for the given resource.static void
openWithExternalApplication(URL url, OperatingSystem.ExternalApplication externalApplication)
Opens the given URL with the given application.static void
setThreadPriority(int priority)
Tries to force-set the given thread priority using native APIs.static void
showInFileBrowser(Path file)
Shows the file in the system file browser.
-
-
-
Method Detail
-
isMac
public static boolean isMac()
-
isLeopard
public static boolean isLeopard()
-
isLeopardOrLater
public static boolean isLeopardOrLater()
-
isSnowLeopard
public static boolean isSnowLeopard()
-
isSnowLeopardOrLater
public static boolean isSnowLeopardOrLater()
-
isLion
public static boolean isLion()
-
isLionOrLater
public static boolean isLionOrLater()
-
isMountainLion
public static boolean isMountainLion()
-
isMountainLionOrLater
public static boolean isMountainLionOrLater()
-
isMavericks
public static boolean isMavericks()
-
isMavericksOrLater
public static boolean isMavericksOrLater()
-
isYosemite
public static boolean isYosemite()
-
isYosemiteOrLater
public static boolean isYosemiteOrLater()
-
isElCapitan
public static boolean isElCapitan()
-
isElCapitanOrLater
public static boolean isElCapitanOrLater()
-
isHighSierra
public static boolean isHighSierra()
-
isHighSierraOrLater
public static boolean isHighSierraOrLater()
-
isMojave
public static boolean isMojave()
-
isMojaveOrLater
public static boolean isMojaveOrLater()
-
isCatalina
public static boolean isCatalina()
-
isCatalinaOrLater
public static boolean isCatalinaOrLater()
-
isBigSur
public static boolean isBigSur()
-
isBigSurOrLater
public static boolean isBigSurOrLater()
-
isWindows
public static boolean isWindows()
-
is64Bit
public static boolean is64Bit()
-
isI386
public static boolean isI386()
-
isPowerPC
public static boolean isPowerPC()
-
isVista
public static boolean isVista()
-
isXP
public static boolean isXP()
-
isWin7
public static boolean isWin7()
-
isWin8
public static boolean isWin8()
-
isWin8_1
public static boolean isWin8_1()
-
isWin10
public static boolean isWin10()
-
isVistaOrLater
public static boolean isVistaOrLater()
-
isXPOrLater
public static boolean isXPOrLater()
-
isWin7OrLater
public static boolean isWin7OrLater()
-
isWin8OrLater
public static boolean isWin8OrLater()
-
isWin8_1OrLater
public static boolean isWin8_1OrLater()
-
isWin10OrLater
public static boolean isWin10OrLater()
-
getJavaRuntimeSupportVersion
public static String getJavaRuntimeSupportVersion()
Version string for the JavaRuntimeSupportVersion.framework, available only on macOS.- Returns:
- version or "unknown", if not known.
-
getDesktopDirectory
public static Path getDesktopDirectory()
-
getLocalApplicationSupportDirectory
public static Path getLocalApplicationSupportDirectory()
Local app data folder.~/Library/Application Support
on macOS,~\AppData\Local
on Vista,~\Local Settings\Application Data
on Windows XP.- Returns:
- local app data folder
- See Also:
OperatingSystemSPI
-
getUsersMusicDirectory
public static Path getUsersMusicDirectory()
User's music folder.~/Music
on macOS,~\Music
on Vista/Win7,~\My Documents\My Music
on Windows XP.- Returns:
- user's music folder
-
moveToTrashIfPossible
public static boolean moveToTrashIfPossible(Path file) throws IOException
Tries to move a file to the trash. If that's not possible (for whatever reason) deletes the file.- Parameters:
file
- file- Returns:
true
, if we succeeded at moving this file to the trash -false
, if it is simply deleted- Throws:
IOException
- if the file can't be moved/deleted
-
showInFileBrowser
public static void showInFileBrowser(Path file) throws IOException
Shows the file in the system file browser.- Parameters:
file
- file- Throws:
IOException
- if things go wrong...
-
openWithExternalApplication
public static void openWithExternalApplication(URL url) throws IOException
Opens the given URL in an external application, typically the OS's default application for the given resource.- Parameters:
url
- url- Throws:
IOException
- if something goes wrong.
-
openWithExternalApplication
public static void openWithExternalApplication(URL url, OperatingSystem.ExternalApplication externalApplication) throws IOException
Opens the given URL with the given application.- Parameters:
url
- urlexternalApplication
- application- Throws:
IOException
- if something goes wrong- See Also:
getExternalApplications(java.net.URL)
-
getExternalApplications
public static OperatingSystem.ExternalApplication[] getExternalApplications(URL url)
Lists the available applications for the given URL.- Parameters:
url
- url- Returns:
- list of applications - the first one should be the default application
-
setThreadPriority
public static void setThreadPriority(int priority)
Tries to force-set the given thread priority using native APIs.- Parameters:
priority
- priority
-
getSystemAppearance
public static String getSystemAppearance()
-
-