Class FormatPreservingProperties

java.lang.Object
java.util.Dictionary<K,V>
java.util.Hashtable<Object,Object>
java.util.Properties
org.apache.openjpa.lib.util.FormatPreservingProperties
All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>

public class FormatPreservingProperties extends Properties
A specialization of Properties that stores its contents in the same order and with the same formatting as was used to read the contents from an input stream. This is useful because it means that a properties file loaded via this object and then written back out later on will only be different where changes or additions were made. By default, the store(java.io.OutputStream, java.lang.String) method in this class does not behave the same as Properties.store(java.io.Writer, java.lang.String). You can cause an instance to approximate the behavior of Properties.store(java.io.Writer, java.lang.String) by invoking setDefaultEntryDelimiter(char) with =, setAddWhitespaceAfterDelimiter(boolean) with false, and setAllowDuplicates(boolean) with true. However, this will only influence how the instance will write new values, not how it will write existing key-value pairs that are modified. In conjunction with a conservative output writer, it is possible to only write to disk changes / additions. This implementation does not permit escaped ' ', '=', ':' characters in key names.
Since:
0.3.3
See Also: