Sweet Home 3D 4.0

com.eteks.sweethome3d.tools
Class OperatingSystem

java.lang.Object
  extended by com.eteks.sweethome3d.tools.OperatingSystem

public class OperatingSystem
extends Object

Tools used to test current user operating system.

Author:
Emmanuel Puybaret

Method Summary
static int compareVersions(String version1, String version2)
          Returns a negative number if version1 < version2, 0 if version1 = version2 and a positive number if version1 > version2.
static File createTemporaryFile(String prefix, String suffix)
          Returns a temporary file that will be deleted when JVM will exit.
static void deleteTemporaryFiles()
          Deletes all the temporary files created with createTemporaryFile.
static File getDefaultApplicationFolder()
          Returns default application folder.
static Comparator<File> getFileVersionComparator()
          Returns a file comparator that sorts file names according to their version number.
static boolean isJavaVersionGreaterOrEqual(String javaMinimumVersion)
          Returns true if the given version is greater than or equal to the version of the current JVM.
static boolean isLinux()
          Returns true if current operating is Linux.
static boolean isMacOSX()
          Returns true if current operating is Mac OS X.
static boolean isMacOSXLeopardOrSuperior()
          Returns true if current operating is Mac OS X 10.5 or superior.
static boolean isWindows()
          Returns true if current operating is Windows.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isLinux

public static boolean isLinux()
Returns true if current operating is Linux.


isWindows

public static boolean isWindows()
Returns true if current operating is Windows.


isMacOSX

public static boolean isMacOSX()
Returns true if current operating is Mac OS X.


isMacOSXLeopardOrSuperior

public static boolean isMacOSXLeopardOrSuperior()
Returns true if current operating is Mac OS X 10.5 or superior.


isJavaVersionGreaterOrEqual

public static boolean isJavaVersionGreaterOrEqual(String javaMinimumVersion)
Returns true if the given version is greater than or equal to the version of the current JVM.

Since:
4.0

compareVersions

public static int compareVersions(String version1,
                                  String version2)
Returns a negative number if version1 < version2, 0 if version1 = version2 and a positive number if version1 > version2. Version strings are first split into parts, each subpart ending at each punctuation, space or when a character of a different type is encountered (letter vs digit). Then each numeric or string subparts are compared to each other, strings being considered greater than numbers except for pre release strings (i.e. alpha, beta, rc). Examples:
 "" < "1"
 "0" < "1.0"
 "1.2beta" < "1.2"
 "1.2beta" < "1.2beta2"
 "1.2beta" < "1.2.0"
 "1.2beta4" < "1.2beta10"
 "1.2beta4" < "1.2"
 "1.2beta4" < "1.2rc"
 "1.2alpha" < "1.2beta"
 "1.2beta" < "1.2rc"
 "1.2rc" < "1.2"
 "1.2rc" < "1.2a"
 "1.2" < "1.2a"
 "1.2a" < "1.2b"
 "1.7.0_11" < "1.7.0_12"
 "1.7.0_11rc1" < "1.7.0_11rc2"
 "1.7.0_11rc" < "1.7.0_11"
 "1.7.0_9" < "1.7.0_11rc"
 "1.2" < "1.2.1"
 "1.2" < "1.2.0.1"
 
 "1.2" = "1.2.0.0" (missing information is considered as 0)
 "1.2beta4" = "1.2 beta-4" (punctuation, space or missing punctuation doesn't influence result)
 "1.2beta4" = "1,2,beta,4"
 

Since:
4.0

createTemporaryFile

public static File createTemporaryFile(String prefix,
                                       String suffix)
                                throws IOException
Returns a temporary file that will be deleted when JVM will exit.

Throws:
IOException - if the file couldn't be created

getFileVersionComparator

public static Comparator<File> getFileVersionComparator()
Returns a file comparator that sorts file names according to their version number.


deleteTemporaryFiles

public static void deleteTemporaryFiles()
Deletes all the temporary files created with createTemporaryFile.


getDefaultApplicationFolder

public static File getDefaultApplicationFolder()
                                        throws IOException
Returns default application folder.

Throws:
IOException

Sweet Home 3D 4.0

© Copyrights 2006-2013 eTeks - All rights reserved
Distributed under GNU General Public License