Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Re writing properties and comments

 
Ronald Whalen
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all!

Is there anyway that I can load a props file and then make changes to props while maintaining the comments associated with the key value pairs? So when I change a property, I can rewrite the props file and have it look the same with comments just new key-value pairs. The comments are quite extensive.

Thanks,

Ronald Whalen
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure that I understand the question. Can you show us an example of how you want your properties file to look?
 
Ronald Whalen
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure..
#here I would like tohave explanatory comments #that are a few lines long.
option1=something
#Some more explanatory comments here to deal
# with the next property
option2=something
Something along those lines.
I bleieve there is a method to print out a string associated with a property. I would like to somehow read in the comments and the key-value pairs then change values or possibly add new ones and retain the original comments.
Thanks,
Ronald Whalen
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic