BowlerKernel
OsInfoUtil.java
Go to the documentation of this file.
1 package com.neuronrobotics.sdk.util;
2 
3 // TODO: Auto-generated Javadoc
7 public class OsInfoUtil {
8 
14  public static boolean is64Bit() {
15  // //System.out.println("Arch: "+getOsArch());
16  return getOsArch().startsWith("x86_64")
17  || getOsArch().startsWith("amd64");
18  }
19 
25  public static boolean isARM() {
26  return getOsArch().startsWith("arm");
27  }
28 
34  public static boolean isPPC() {
35  return getOsArch().toLowerCase().contains("ppc");
36  }
37 
43  public static boolean isCortexA8() {
44  if (isARM()) {
45  // TODO check for cortex a8 vs arm9 generic
46  return true;
47  }
48  return false;
49  }
50 
56  public static boolean isWindows() {
57  // //System.out.println("OS name: "+getOsName());
58  return getOsName().toLowerCase().startsWith("windows")
59  || getOsName().toLowerCase().startsWith("microsoft")
60  || getOsName().toLowerCase().startsWith("ms");
61  }
62 
68  public static boolean isLinux() {
69  return getOsName().toLowerCase().startsWith("linux");
70  }
71 
77  public static boolean isOSX() {
78  return getOsName().toLowerCase().startsWith("mac");
79  }
80 
86  public static String getExtension() {
87  if (isWindows()) {
88  return ".zip";
89  }
90  if (isLinux()) {
91  return ".zip";
92  }
93  if (isOSX()) {
94  return ".dmg";
95  }
96  return "";
97  }
98 
104  public static String getOsName() {
105  return System.getProperty("os.name");
106  }
107 
113  public static String getOsArch() {
114  return System.getProperty("os.arch");
115  }
116 
122  @SuppressWarnings("unused")
123  public static String getIdentifier() {
124  return getOsName() + " : " + getOsArch();
125  }
126 }