aspose file tools*
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
Similar Threads
Getting all key-value pairs from a hashmap in a random order
doubt in properties
Which one is better? Hash Map or Properties File
making java program user friendly
Storing key-value pairs: Better apporaches for storing and reading?