Public static void main (string [] ARGs ){
String Path = "E:/workspace/bocmarketdata/src/config/periodcode. properties ";
Try {
Map <string, string> periodcodemap = readconfigformap (PATH );
Set <string> set1 = periodcodemap. keyset ();
For (string S: set1 ){
System. Out. println (S + "," + periodcodemap. Get (s ));
}
} Catch (exception e ){
E. printstacktrace ();
}
}
/**
* Read the file and generate Map <string, string>. value is displayed on the left and on the right of the key.
* @ Param path
* @ Return
* @ Throws exception
*/
Public static Map <string, string> readconfigformap (string path) throws exception {
Bufferedreader BF = NULL;
Try {
Inputstream in = new fileinputstream (new file (PATH ));
// Path E:/workspace/edealingv3.0 _ etof/src/CONF/config/institutionl_ip_config.properties
Reader reader = new inputstreamreader (in );
BF = new bufferedreader (Reader );
} Catch (exception e ){
E. getmessage ();
}
String ROW = NULL;
Map <string, string> SMAP = new hashmap <string, string> ();
While (null! = (ROW = BF. Readline ())){
If (! Row. Equals ("")){
If (row. startswith ("#")){
Continue;
}
String key = row. substring (0, row. indexof ("= "));
String value = row. substring (row. indexof ("=") + 1, row. Length ());
SMAP. Put (Key, value );
}
}
BF. Close ();
Return SMAP;
}