+ byte[] bytes = (byte[]) jsutil.getFile(fileStr, false);
+ cacheFileData(fileStr, bytes);
+ return bytes;
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unused")
+ public static String getFileAsString(String url)
+ {
+ if (isJS && url != null)
+ {
+ String ret = (String) jsutil.getFile(url, true);
+ cacheFileData(url, ret);
+ return ret;
+ }
+ return null;
+ }
+
+ public static boolean setFileBytes(File f, String urlstring)
+ {
+ if (isJS && f != null && urlstring != null)
+ {
+ @SuppressWarnings("unused")
+ byte[] bytes = getFileAsBytes(urlstring);
+ jsutil.setFileBytes(f, bytes);
+ return true;
+ }
+ return false;
+ }
+
+ public static void addJ2SBinaryType(String ext)
+ {
+ if (isJS)
+ {
+ jsutil.addBinaryFileType(ext);
+ }
+ }
+
+ public static String getUniqueAppletID()
+ {
+ return (isJS ? (String) jsutil.getAppletAttribute("_uniqueId") : null);
+ }
+
+ /**
+ * Read the Info block for this applet.
+ *
+ * @param prefix
+ * "jalview_"
+ * @param p
+ * @return unique id for this applet
+ */
+ public static void readInfoProperties(String prefix, Properties p)
+ {
+ if (isJS)
+ {
+ String id = getUniqueAppletID();
+
+ String key = "";
+ String value = "";
+ @SuppressWarnings("unused")
+ Object info = jsutil.getAppletAttribute("__Info");
+ /**
+ * @j2sNative for (key in info) { value = info[key];
+ */
+
+ if (key.indexOf(prefix) == 0)
+ {
+ System.out.println("Platform id=" + id + " reading Info." + key
+ + " = " + value);
+ p.put(key, value);
+
+ }
+
+ /**
+ * @j2sNative }
+ */