?? propertyexamine.java
字號:
/*
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
author: Yuan yongfu lijin liyong lib 511,the College of Mathematics and Computer Science,HuNan Normal University,China
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
*/
package edu.hunnu.webjetchecker.propertytest;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StringReader;
import edu.hunnu.webjetchecker.config.Config;
public class PropertyExamine {
public void propertyTest(String command) {
// write command to command.txt and test deadlocks executing the MWB
int length = 0;
try {
StringReader sr = new StringReader(command);
/*
* 通過配置文件找到mwb的位置
*/
Config config = new Config();
String path = config.getMwb_path();
FileWriter out = new FileWriter(path + "\\command.txt");
char b[] = new char[10000];
length = sr.read(b, 0, 10000);
out.write(b, 0, length);
out.flush();
out.close();
} catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
}
String ls_1;
Process process;
try {
/*
* 通過配置文件找到mwb的位置
*/
Config config = new Config();
String path = config.getMwb_path();
// 設置...\sml\ly.bat中的內(nèi)容
String pichu = "@" + path.charAt(0) + ":\n";
pichu += "@cd " + path + "\n";
pichu += "@call " + path + "\\mwb.bat\n";
StringReader r = new StringReader(pichu);
FileWriter outFile = new FileWriter(path + "\\ly.bat");
char bb[] = new char[10000];
length = r.read(bb, 0, 10000);
outFile.write(bb, 0, length);
outFile.flush();
outFile.close();
process = Runtime.getRuntime().exec(path + "\\ly.bat");
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(process.getInputStream()));
while ((ls_1 = bufferedReader.readLine()) != null)
System.out.println(ls_1);
/*
* 通過配置文件找到mwb的位置
*/
} catch (IOException e) {
e.printStackTrace();
}
}
public String readFile(File resultFile) {
// read the error information from file!
String result = "";
int length = 0;
char s[] = new char[10000];
try {
FileReader f = new FileReader(resultFile);
length = f.read(s);
f.close();
} catch (Exception e) {
System.out.println("字符數(shù)組長度不夠");
}
if (length != -1)
result = new String(s, 0, length);
return result;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -