代碼描述
用java對windows注冊表進行編輯是一個比較困難的任務
這裡允許的基本功能是添加
//主要的方法
add(String location
delete(String location
query(String location
//查詢消息用到的方法
getKey() => 檢索的key名
getValue() => 根據key得到的value
getType() => 根據key得到的數據類型 (REG_SZ
調用方法
例:
public static void main(String[] args) {
try {
RegKeyManager rkm = new RegKeyManager();
//
// rkm
//
rkm
System
// rkm
// rkm
} catch (Exception e) {
e
}
}
注:
package languageexpress
import java
public class RegKeyManager {
private final String TYPES[] = {
private String type =
protected void query(String loc
Process p = Runtime
BufferedReader in = new BufferedReader( new InputStreamReader( p
String out =
while ( ( out = in
if (out
}
in
String str[] = out
int b =
for (int a=
if ( str[a]
switch (b) {
case
case
case
}
b++;
}
}
}
protected String getKey() { return key; }
protected String getType() { return type; }
protected String getValue() { return value; }
protected boolean add(String loc
boolean comp = false
for (int a =
if (dType
}
if ( valid ) {
Process p = Runtime
BufferedReader in = new BufferedReader( new InputStreamReader( p
String out =
while ( (out = in
if (out
}
in
}
return comp;
}
protected boolean delete(String loc
boolean comp = false;
Process p = Runtime
BufferedReader in = new BufferedReader( new InputStreamReader( p
String out =
while ( ( out = in
if (out
}
in
return comp;
}
}
From:http://tw.wingwit.com/Article/program/Java/hx/201311/26615.html