Java??Properties??????
???????????? ???????[ 2015/12/28 11:20:58 ] ??????????????????? ???????
????2????????????????????Test.properties??
????name=JJ
????Weight=4444
????Height=3333
????1 public class getProperties {
????2 public static void main(String[] args) throws FileNotFoundException?? IOException {
????3 Properties pps = new Properties();
????4 pps.load(new FileInputStream("Test.properties"));
????5 Enumeration enum1 = pps.propertyNames();//????????????????
????6 while(enum1.hasMoreElements()) {
????7 String strKey = (String) enum1.nextElement();
????8 String strValue = pps.getProperty(strKey);
????9 System.out.println(strKey + "=" + strValue);
????10 }
????11 }
????12 }
????3???????????????
????????key???value
???????properties????????
????д???μ?properties???
1 //????Properties????????
2 public class TestProperties {
3 //????Key???Value
4 public static String GetValueByKey(String filePath?? String key) {
5 Properties pps = new Properties();
6 try {
7 InputStream in = new BufferedInputStream (new FileInputStream(filePath));
8 pps.load(in);
9 String value = pps.getProperty(key);
10 System.out.println(key + " = " + value);
11 return value;
12
13 }catch (IOException e) {
14 e.printStackTrace();
15 return null;
16 }
17 }
18
19 //???Properties????????
20 public static void GetAllProperties(String filePath) throws IOException {
21 Properties pps = new Properties();
22 InputStream in = new BufferedInputStream(new FileInputStream(filePath));
23 pps.load(in);
24 Enumeration en = pps.propertyNames(); //????????????????
25
26 while(en.hasMoreElements()) {
27 String strKey = (String) en.nextElement();
28 String strValue = pps.getProperty(strKey);
29 System.out.println(strKey + "=" + strValue);
30 }
31
32 }
33
34 //д??Properties???
35 public static void WriteProperties (String filePath?? String pKey?? String pValue) throws IOException {
36 Properties pps = new Properties();
37
38 InputStream in = new FileInputStream(filePath);
39 //?????????ж???????б???????????
40 pps.load(in);
41 //???? Hashtable ????? put????? getProperty ?????????????
42 //????????????????????????????????? Hashtable ???? put ??????
43 OutputStream out = new FileOutputStream(filePath);
44 pps.setProperty(pKey?? pValue);
45 //???????? load ????????? Properties ???е?????
46 //???? Properties ???е??????б???????????д???????
47 pps.store(out?? "Update " + pKey + " name");
48 }
49
50 public static void main(String [] args) throws IOException{
51 //String value = GetValueByKey("Test.properties"?? "name");
52 //System.out.println(value);
53 //GetAllProperties("Test.properties");
54 WriteProperties("Test.properties"??"long"?? "212");
55 }
56 }
?????????
????Test.properties??????????????
????#Update long name
????#Sun Feb 23 18:17:16 CST 2014
????name=JJ
????Weight=4444
????long=212
????Height=3333
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
Java???????????Щ???????????????Java????????????????Java?б???Map????????Java Web???????????????Java??????????????д?????Java????????7???????????????????????(java .net ?????)???Java??????????Python??????Java webdriver??λ????????′????е?????Java??д??????????????????Java???????????????JavaScript????????????Java?????????????????? Java???????10??????????????Java?м????????????????java???????ü???????????м???????????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????