Reading from an 'ini' file

I am looking for information about how to read from an 'ini' file, ie.[Document]line1=documentline2=image;line3=pictureI am aware of the class 'Properties' but how can I read when a property is commented out (;).Thank you for your help.
[289 byte] By [l_marcelo] at [2007-9-27 16:30:35]
# 1

hmm, that's a good point- I'm not sure why Properties wasn't created in a more scalable way (short of carelessness), so that you can specify reserved characters, or at least over-ride its parsing logic more easily. From a time-to-market perspective, it might be easier to just write a parsing tool that changes all of your special comment characters into comment characters supported by the java.util.Properties API (rather then writing your own load logic for the properties file) ... I would guess (pure guess) that Properties adds each key/value via inherited method put(key, value) so you could write a subclass that extends Properties and over-rides that method, so that it does not actually put keys with the reserved characters into the Map. That might be the easiest solution I can envision, you sould just do some thing like,

public void put(Object key, Object value) {

if ((key instanceof java.lang.String) && (key.startsWith(RESERVED_STRING)) {

//don't add it

return;

}

else {

super.put(key, value);

}

}

The only problem is, you're relying on Properties to use that method when adding to the underlying Map (which may not be the case now or in the future) ... .... maybe some one else has an easier answer.

rvflannery at 2007-7-6 0:48:39 > top of Java-index,Core,Core APIs...