本文整理匯總了Java中com.oracle.java.testlibrary.OutputBuffer類的典型用法代碼示例。如果您正苦於以下問題:Java OutputBuffer類的具體用法?Java OutputBuffer怎麽用?Java OutputBuffer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
OutputBuffer類屬於com.oracle.java.testlibrary包,在下文中一共展示了OutputBuffer類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: main
import com.oracle.java.testlibrary.OutputBuffer; //導入依賴的package包/類
public static void main (String[] args) {
System.out.println(\u00CB);
try {
if (!Platform.shouldSAAttach()) {
System.out.println("SA attach not expected to work - test skipped.");
return;
}
int pid = ProcessTools.getProcessId();
JDKToolLauncher jmap = JDKToolLauncher.create("jmap")
.addToolArg("-F")
.addToolArg("-dump:live,format=b,file=" + dumpFile)
.addToolArg(Integer.toString(pid));
ProcessBuilder pb = new ProcessBuilder(jmap.getCommand());
OutputBuffer output = ProcessTools.getOutput(pb);
Process p = pb.start();
int e = p.waitFor();
System.out.println("stdout:");
System.out.println(output.getStdout());
System.out.println("stderr:");
System.out.println(output.getStderr());
if (e != 0) {
throw new RuntimeException("jmap returns: " + e);
}
if (! new File(dumpFile).exists()) {
throw new RuntimeException("dump file NOT created: '" + dumpFile + "'");
}
} catch (Throwable t) {
t.printStackTrace();
throw new RuntimeException("Test failed with: " + t);
}
}
示例2: main
import com.oracle.java.testlibrary.OutputBuffer; //導入依賴的package包/類
public static void main (String[] args) {
System.out.println(Ã);
try {
int pid = ProcessTools.getProcessId();
JDKToolLauncher jmap = JDKToolLauncher.create("jmap")
.addToolArg("-F")
.addToolArg("-dump:live,format=b,file=" + dumpFile)
.addToolArg(Integer.toString(pid));
ProcessBuilder pb = new ProcessBuilder(jmap.getCommand());
OutputBuffer output = ProcessTools.getOutput(pb);
Process p = pb.start();
int e = p.waitFor();
System.out.println("stdout:");
System.out.println(output.getStdout());
System.out.println("stderr:");
System.out.println(output.getStderr());
if (e != 0) {
throw new RuntimeException("jmap returns: " + e);
}
if (! new File(dumpFile).exists()) {
throw new RuntimeException("dump file NOT created: '" + dumpFile + "'");
}
} catch (Throwable t) {
t.printStackTrace();
throw new RuntimeException("Test failed with: " + t);
}
}