File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Re writing properties and comments Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Re writing properties and comments" Watch "Re writing properties and comments" New topic

Re writing properties and comments

Ronald Whalen
Ranch Hand

Joined: Mar 27, 2001
Posts: 38
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.


Ronald Whalen
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
Not sure that I understand the question. Can you show us an example of how you want your properties file to look?

"JavaRanch, where the deer and the Certified play" - David O'Meara
Ronald Whalen
Ranch Hand

Joined: Mar 27, 2001
Posts: 38
#here I would like tohave explanatory comments #that are a few lines long.
#Some more explanatory comments here to deal
# with the next property
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.
Ronald Whalen
I agree. Here's the link:
subject: Re writing properties and comments
It's not a secret anymore!