本文整理汇总了Java中com.sun.squawk.VM.getCurrentIsolate方法的典型用法代码示例。如果您正苦于以下问题:Java VM.getCurrentIsolate方法的具体用法?Java VM.getCurrentIsolate怎么用?Java VM.getCurrentIsolate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.squawk.VM
的用法示例。
在下文中一共展示了VM.getCurrentIsolate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOutput
import com.sun.squawk.VM; //导入方法依赖的package包/类
private static PrintStream getOutput(boolean err) {
/*if[ENABLE_MULTI_ISOLATE]*/
String url = System.getProperty(err ? "java.lang.System.err" : "java.lang.System.out");
if (url == null) {
url = err ? "debug:err" : "debug:";
}
Isolate isolate = VM.getCurrentIsolate();
OutputStream os;
if (err) {
isolate.addErr(url);
os = isolate.stderr;
} else {
isolate.addOut(url);
os = isolate.stdout;
}
return new PrintStream(os);
/*else[ENABLE_MULTI_ISOLATE]*/
// return new PrintStream(new PrivateOutputStream(err));
/*end[ENABLE_MULTI_ISOLATE]*/
}
示例2: getProperty
import com.sun.squawk.VM; //导入方法依赖的package包/类
/**
* Gets the system property indicated by the specified key.
*
* @param key the name of the system property.
* @return the string value of the system property,
* or <code>null</code> if there is no property with that key.
*
* @exception NullPointerException if <code>key</code> is
* <code>null</code>.
* @exception IllegalArgumentException if <code>key</code> is empty.
*/
public static String getProperty(String key) {
if (key == null) {
throw new NullPointerException(/*"key can't be null"*/);
}
if (key.length() == 0) {
throw new IllegalArgumentException(/*"key can't be empty"*/);
}
/*
* These are the hard-coded properties that cannot be changed.
*/
if (key.equals("microedition.configuration")) { return "CLDC-1.1"; }
if (key.equals("microedition.encoding")) { return Helper.defaultEncoding; }
if (key.equals("microedition.locale")) { return "en-US"; }
if (key.equals("microedition.platform")) { return "j2me"; }
// if (key.equals("microedition.profiles")) { return MIDlet.SUPPORTED_PROFILE; }
if (key.equals("microedition.profiles")) { return "IMP-1.0"; }
/*if[!FLASH_MEMORY]*/
if (key.equals("awtcore.classbase")) { return "awtcore.impl.squawk"; }
/*end[FLASH_MEMORY]*/
if (key.equals("javax.microedition.io.Connector.protocolpath")) { return "com.sun.squawk.io"; }
if (key.equals("file.separator")) { return "" + VM.getFileSeparatorChar(); }
if (key.equals("path.separator")) { return "" + VM.getPathSeparatorChar(); }
if (VM.getCurrentIsolate() == null) {
return null;
}
String value = VM.getCurrentIsolate().getProperty(key);
return value;
}