I'm using Apache common-configuration library to read properties files for various reasons. My code is given below. By default, it strips the spaces before and after the values, which I want to avoid. Is there a way to do that?
CompositeConfiguration config = new CompositeConfiguration();
PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration();
URL url = CommonConfig.class.getResource("samplePropertiesFile.properties");
Reader reader = new FileReader(new File(url.getFile()));
Values are Java escaped1, so use
\u0020 for leading and trailing spaces that shouldn't be removed.
Only the first leading and last trailing space needs this, e.g.
key = \u0020 value \u0020
will be the string
Write CustomPropertiesConfiguration like the example in "Custom properties readers and writers" section in https://commons.apache.org/proper/commons-configuration/userguide/howto_properties.html
1) According to source code.