<TF_INFO_START>
<TF_HOST>`TF_IN`
<TF_ID>`3219`
<TF_INFO_END>
<SF_INFO>
<SF_NAME>`JOHN`<IP>`10.110.12.12`<SF_PORT>`9101`
<END_SF_INFO>
<COMPONENT_START_TAG>
<COMPONENT_NAME>`AISMOD`<PATH>`AISPATH`<TYPE>`U`<M>`main`
<COMPONENT_END_TAG>
I want to parse the above test.conf file and display each parameter in the log file.I have tried parsing it like
Properties configFile = new Properties();
configFile.load(new FileInputStream("C:/Users/JOHN/Desktop/test.conf"));
String foo = configFile.getProperty("TF_HOST");
I couldn't get value of TF_HOST and other parameters.I get null result..
Can anyone help me in parsing the above file content
Write your conf file as key=value then using ResourceBundle you can easily read the file. Like
ResourceBundle rb = ResourceBundle.getundle("com.demo.conf");//path for conf file in my case it is in com.demo package
String value = rb.getString(key);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.