本文目錄一覽:
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,就可以恢復完成,如下圖:
結果如下:
原創文章,作者:L47ET,如若轉載,請註明出處:https://www.506064.com/zh-hk/n/129567.html