
com.github.sarxos.webcam.util.OsUtils Maven / Gradle / Ivy
Go to download
This library allows you to use your PC webcam, IP or network cameras directly from Java. It's compatible with most operating systems (Windows, Linux, MacOS).
package com.github.sarxos.webcam.util;
/**
* Just a simple enumeration with supported (not yet confirmed) operating
* systems.
*
* @author Bartosz Firyn (sarxos)
*/
public enum OsUtils {
/**
* Microsoft Windows
*/
WIN,
/**
* Linux or UNIX.
*/
NIX,
/**
* Mac OS X
*/
OSX;
private static OsUtils os = null;
/**
* Get operating system.
*
* @return OS
*/
public static final OsUtils getOS() {
if (os == null) {
String osp = System.getProperty("os.name").toLowerCase();
if (osp.indexOf("win") >= 0) {
os = WIN;
} else if (osp.indexOf("mac") >= 0) {
os = OSX;
} else if (osp.indexOf("nix") >= 0 || osp.indexOf("nux") >= 0) {
os = NIX;
} else {
throw new RuntimeException(osp + " is not supported");
}
}
return os;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy