📄 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中的内容
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("字符数组长度不够");
}
if (length != -1)
result = new String(s, 0, length);
return result;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -