工程clean后 报错?
工程clean后不能导入XXXActivity_ 需要重新保存 哪位大哥知道如何解决
工程clean后不能导入XXXActivity_ 需要重新保存 哪位大哥知道如何解决
2015-12-21
/**
* 修改文件
*/
public class BUG {
public String read(String filePath) {
BufferedReader br = null;
String line = null;
StringBuffer buf = new StringBuffer();
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(filePath), "GBK"));
while ((line = br.readLine()) != null) {
buf.append(line);
buf.append(System.getProperty("line.separator"));
}
} catch (Exception e) {
e.printStackTrace();
} finally {
// 关闭流
if (br != null) {
try {
br.close();
} catch (IOException e) {
br = null;
}
}
}
return buf.toString();
}
public void write(String filePath, String content) {
BufferedWriter bw = null;
try {
bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filePath), "GBK"));
bw.write(content);
} catch (Exception e) {
e.printStackTrace();
} finally {
// 关闭流
if (bw != null) {
try {
bw.close();
} catch (IOException e) {
bw = null;
}
}
}
}
/**
* 主方法
*/
public static void main(String[] args) {
// 文件路径
String[] path = new String[]{"D:/Error0Activity.java",
"D:/Error1Activity.java",
"D:/Error2Activity.java"};
BUG debug = new BUG();
for(String filePath : path)
debug.write(filePath, debug.read(filePath)); // 读取修改文件
try {
System.out.println("蛋疼");
} catch (Exception e) {
e.printStackTrace();
}
}
举报