All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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).

The newest version!
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 - 2024 Weber Informatics LLC | Privacy Policy