List of usage examples for java.lang System getProperty
public static String getProperty(String key)
From source file:Main.java
/** * Checks if application is running on a Mac OS X system * * @return True if app runs on Mac OS X, false it not *//* w w w. j ava 2s . c om*/ public static boolean isMacOSX() { return "Mac OS X".equals(System.getProperty("os.name")); }
From source file:com._17od.upm.gui.MainWindow.java
public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { try { // Use the System look and feel Preferences.load(); Translator.initialise(); Double jvmVersion = new Double(System.getProperty("java.specification.version")); if (jvmVersion.doubleValue() < 1.4) { JOptionPane.showMessageDialog(null, Translator.translate("requireJava14"), Translator.translate("problem"), JOptionPane.ERROR_MESSAGE); System.exit(1); } else { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); AppWindow = new MainWindow(applicationName); }/*from ww w. j a va 2s . c o m*/ } catch (Exception e) { e.printStackTrace(); } } }); }
From source file:Main.java
public static String upcaseFileName(String s) { if (System.getProperty("file.separator").equals("\\")) { return s.toUpperCase(); } else {// w ww . ja va 2s. co m return s; } }
From source file:Main.java
/** * Method used to check if the code is currently running on Android Platform * via System properties {@see http://developer.android.com/reference/java/lang/System.html#getProperty()} * * @return true if running on Android, false otherwise *//*from w w w .jav a 2 s .co m*/ public static boolean isRunningOnAndroid() { return System.getProperty("java.vendor").contains("Android"); }
From source file:OperatingSystem.java
private static OperatingSystem initOS() { String osName = System.getProperty("os.name"); if (osName.equals("Mac OS X")) return OSX; if (osName.startsWith("Windows ")) return WINDOWS; if (osName.startsWith("Linux")) return LINUX; return UNKNOWN; }
From source file:Main.java
public static String convertStreamToString(InputStream is) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(is)); StringBuilder sb = new StringBuilder(); String line = null;//from w w w. j a v a 2 s . co m String NL = System.getProperty("line.separator"); while ((line = reader.readLine()) != null) { sb.append(line + NL); } sb.replace(sb.length() - 1, sb.length(), ""); is.close(); return sb.toString(); }
From source file:Main.java
public static String textToString(Reader xquery) throws IOException { StringBuilder sb = new StringBuilder(); BufferedReader br = new BufferedReader(xquery); String NL = System.getProperty("line.separator"); String line = null;//from w ww .j av a 2s .com try { while ((line = br.readLine()) != null) { sb.append(line).append(NL); } sb.deleteCharAt(sb.length() - 1); } finally { br.close(); } return sb.toString(); }
From source file:Main.java
/** * Are we running on Mac OS 10.4.x ?//from ww w. ja v a2 s. c o m * * @return true or false */ public static boolean isMacOS_10_4() { boolean rval = false; if (isMacintosh()) { String osVersion = System.getProperty("os.version"); if (osVersion != null) { rval = osVersion.startsWith("10.4"); } } return rval; }
From source file:Main.java
public static String readLine(InputStream in) { final BufferedReader reader = new BufferedReader(new InputStreamReader(in)); final StringBuilder out = new StringBuilder(); final String newLine = System.getProperty("line.separator"); String line;//from w w w. j a v a2 s .co m try { while ((line = reader.readLine()) != null) { out.append(line); out.append(newLine); } } catch (final IOException e) { throw new RuntimeException(e); } return out.toString(); }
From source file:Main.java
public static String getString(InputStream in) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(in)); StringBuilder builder = new StringBuilder(); String line;//from www . j ava2s .c o m while ((line = reader.readLine()) != null) { builder.append(line); builder.append(System.getProperty("line.separator")); } return builder.toString(); }