类 DefaultPropertiesPersister

  • 所有已实现的接口:
    PropertiesPersister

    public class DefaultPropertiesPersister
    extends Object
    implements PropertiesPersister
    Default implementation of the PropertiesPersister interface. Follows the native parsing of java.util.Properties.

    Allows for reading from any Reader and writing to any Writer, for example to specify a charset for a properties file. This is a capability that standard java.util.Properties unfortunately lacked up until JDK 5: You were only able to load files using the ISO-8859-1 charset there.

    Loading from and storing to a stream delegates to Properties.load and Properties.store, respectively, to be fully compatible with the Unicode conversion as implemented by the JDK Properties class. As of JDK 6, Properties.load/store will also be used for readers/writers, effectively turning this class into a plain backwards compatibility adapter.

    The persistence code that works with Reader/Writer follows the JDK's parsing strategy but does not implement Unicode conversion, because the Reader/Writer should already apply proper decoding/encoding of characters. If you use prefer to escape unicode characters in your properties files, do not specify an encoding for a Reader/Writer (like ReloadableResourceBundleMessageSource's "defaultEncoding" and "fileEncodings" properties).

    从以下版本开始:
    10.03.2004
    作者:
    Juergen Hoeller
    另请参阅:
    Properties, Properties.load(java.io.Reader), Properties.store(java.io.Writer, java.lang.String)