Package spock.util.environment
Class OperatingSystem
- java.lang.Object
-
- spock.util.environment.OperatingSystem
-
public class OperatingSystem extends Object
Provides information on the current operating system, such as its name, version, and family.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOperatingSystem.FamilyAn operating system family.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OperatingSystemgetCurrent()Returns the current operating system.OperatingSystem.FamilygetFamily()Returns the family of the operating system.StringgetName()Returns the name of the operating system, as returned by theos.namesystem property.StringgetVersion()Returns the version of the operating system, as returned by theos.versionsystem property.booleanisLinux()Tells whether the operating system family is Linux.booleanisMacOs()Tells whether the operating system family is Mac OS.booleanisOther()Tells whether the operating system family is anything other than those listed above.booleanisSolaris()Tells whether the operating system family is Solaris.booleanisWindows()Tells whether the operating system family is Windows.
-
-
-
Method Detail
-
getName
public String getName()
Returns the name of the operating system, as returned by theos.namesystem property.- Returns:
- the name of the operating system, as returned by the
os.namesystem property
-
getVersion
public String getVersion()
Returns the version of the operating system, as returned by theos.versionsystem property.- Returns:
- the version of the operating system, as returned by the
os.versionsystem property
-
getFamily
public OperatingSystem.Family getFamily()
Returns the family of the operating system.- Returns:
- the family of the operating system
-
isLinux
public boolean isLinux()
Tells whether the operating system family is Linux.- Returns:
- whether the operating system family is Linux
-
isMacOs
public boolean isMacOs()
Tells whether the operating system family is Mac OS.- Returns:
- whether the operating system family is Mac OS
-
isWindows
public boolean isWindows()
Tells whether the operating system family is Windows.- Returns:
- whether the operating system family is Windows
-
isSolaris
public boolean isSolaris()
Tells whether the operating system family is Solaris.- Returns:
- whether the operating system family is Solaris
-
isOther
public boolean isOther()
Tells whether the operating system family is anything other than those listed above.- Returns:
- whether the operating system family is anything other than those listed above
-
getCurrent
public static OperatingSystem getCurrent()
Returns the current operating system.- Returns:
- the current operating system
-
-