I want to support property file format like below (allow quotes surround the value):
key1=value1
key2="value2"
key3='value'
My question is does Java Properties class implementation handles double/single quoted values like above? I mean auto-removing quotes.
Actually I tried it's not, just want to confirm here. So I have to remove quotes myself.
EDIT:
I had a code below for my simple case:
String path = "/tmp/my.properties";
Properties p = new Properties();
p.load(new FileInputStream(new File(path)));
String v = p.getProperty("key2");
if((v.startsWith("\"") && v.endsWith("\"")) ||
(v.startsWith("\'") && v.endsWith("\'"))) {
v = v.substring(1, v.length()-1);
}
Any recommendation on best practice to handle this?
Thanks