+ public boolean isHeadless()\r
+ {\r
+ String hdls = java.lang.System.getProperty("java.awt.headless");\r
+\r
+ return hdls != null && hdls.equals("true");\r
+ }\r
+\r
+ /**\r
+ * \r
+ * @return nominal maximum command line length for this platform\r
+ */\r
+ public static int getMaxCommandLineLength()\r
+ {\r
+ // TODO: determine nominal limits for most platforms.\r
+ return 2046; // this is the max length for a windows NT system.\r
+ }\r
+\r
+ /**\r
+ * escape a string according to the local platform's escape character\r
+ * @param file\r
+ * @return escaped file\r
+ */\r
+ public static String escapeString(String file)\r
+ {\r
+ StringBuffer f=new StringBuffer();\r
+ int p=0,lastp=0;\r
+ while ((p=file.indexOf('\\',lastp))>-1)\r
+ {\r
+ f.append(file.subSequence(lastp,p));\r
+ f.append("\\\\");\r
+ lastp=p+1;\r
+ }\r
+ f.append(file.substring(lastp));\r
+ return f.toString();\r
+ }\r