本文目录一览:
- 1、java中的restore defaults是什么意思
- 2、java 中restore可以回到原值吗
- 3、在eclipse不小心删掉了java文件怎么找回?
java中的restore defaults是什么意思
java中的restore defaults是
恢复默认值的意思,是不是操作了复位。
java 中restore可以回到原值吗
public class RestoreDatabase {
public static final String mysqlBinPath = "C://Program Files//a href="" class='replace_word' title="MySQL知识库" target='_blank' style='color:#df3434; font-weight:bold;'MySQL/a//a href="" class='replace_word' title="MySQL知识库" target='_blank' style='color:#df3434; font-weight:bold;'mysql/a Server 5.1//bin";
public static final String username = "root";
public static final String password = "admin";
public static final String dbname = "test_manager";
public static final String dbPath = "d://test_manager2.sql";
public static final String host = "localhost";
public void store(String dest, String dbname) throws IOException {
InputStream input = new FileInputStream(dest);
restore(input,dbname);
}
private void restore(InputStream input, String dbname) throws IOException {
String command = "cmd /c" + mysqlBinPath + "mysql -h "+host+" -u" + username + " -p" + password + " " + dbname;
Process process = Runtime.getRuntime().exec(command);
OutputStream out = process.getOutputStream();
String line = null;
String outStr = null;
StringBuffer sb = new StringBuffer("");
BufferedReader br = new BufferedReader(new InputStreamReader(input,"utf8"));
while((line = br.readLine()) != null) {
sb.append(line + "/n");
}
outStr = sb.toString();
OutputStreamWriter writer = new OutputStreamWriter(out,"utf8");
writer.write(outStr);
writer.flush();
out.close();
br.close();
writer.close();
}
public static void main(String[] args) throws IOException {
RestoreDatabase restore = new RestoreDatabase();
restore.store(dbPath, dbname);
}
}
在eclipse不小心删掉了java文件怎么找回?
eclipse中不小心删了java文件可以通过eclipse提供的恢复功能来恢复,步骤如下:
右键点击java项目工程名,选择restort from history,如下图:
选择要恢复的java文件,点击restore,就可以恢复完成,如下图:
结果如下: