org.springframework.util

## 类 DefaultPropertiesPersister

- java.lang.Object
- - org.springframework.util.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)`

- - ### 构造器概要

    构造器
    构造器和说明
    `DefaultPropertiesPersister()`

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `void` | `load(Properties props, InputStream is)` Load properties from the given InputStream into the given Properties object.
    `void` | `load(Properties props, Reader reader)` Load properties from the given Reader into the given Properties object.
    `void` | `loadFromXml(Properties props, InputStream is)` Load properties from the given XML InputStream into the given Properties object.
    `void` | `store(Properties props, OutputStream os, String header)` Write the contents of the given Properties object to the given OutputStream.
    `void` | `store(Properties props, Writer writer, String header)` Write the contents of the given Properties object to the given Writer.
    `void` | `storeToXml(Properties props, OutputStream os, String header)` Write the contents of the given Properties object to the given XML OutputStream.
    `void` | `storeToXml(Properties props, OutputStream os, String header, String encoding)` Write the contents of the given Properties object to the given XML OutputStream.

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 构造器详细资料

    - #### DefaultPropertiesPersister

          public DefaultPropertiesPersister()

  - ### 方法详细资料

    - #### load

          public void load(Properties props,
                           InputStream is)
                    throws IOException

      从接口复制的说明: `PropertiesPersister`
      Load properties from the given InputStream into the given Properties object.
      指定者:
        `load` 在接口中 `PropertiesPersister`
      参数:
        `props` - the Properties object to load into
        `is` - the InputStream to load from
      抛出:
        `IOException` - in case of I/O errors
      另请参阅:
        `Properties.load(java.io.Reader)`

    - #### load

          public void load(Properties props,
                           Reader reader)
                    throws IOException

      从接口复制的说明: `PropertiesPersister`
      Load properties from the given Reader into the given Properties object.
      指定者:
        `load` 在接口中 `PropertiesPersister`
      参数:
        `props` - the Properties object to load into
        `reader` - the Reader to load from
      抛出:
        `IOException` - in case of I/O errors

    - #### store

          public void store(Properties props,
                            OutputStream os,
                            String header)
                     throws IOException

      从接口复制的说明: `PropertiesPersister`
      Write the contents of the given Properties object to the given OutputStream.
      指定者:
        `store` 在接口中 `PropertiesPersister`
      参数:
        `props` - the Properties object to store
        `os` - the OutputStream to write to
        `header` - the description of the property list
      抛出:
        `IOException` - in case of I/O errors
      另请参阅:
        `Properties.store(java.io.Writer, java.lang.String)`

    - #### store

          public void store(Properties props,
                            Writer writer,
                            String header)
                     throws IOException

      从接口复制的说明: `PropertiesPersister`
      Write the contents of the given Properties object to the given Writer.
      指定者:
        `store` 在接口中 `PropertiesPersister`
      参数:
        `props` - the Properties object to store
        `writer` - the Writer to write to
        `header` - the description of the property list
      抛出:
        `IOException` - in case of I/O errors

    - #### loadFromXml

          public void loadFromXml(Properties props,
                                  InputStream is)
                           throws IOException

      从接口复制的说明: `PropertiesPersister`
      Load properties from the given XML InputStream into the given Properties object.
      指定者:
        `loadFromXml` 在接口中 `PropertiesPersister`
      参数:
        `props` - the Properties object to load into
        `is` - the InputStream to load from
      抛出:
        `IOException` - in case of I/O errors
      另请参阅:
        `Properties.loadFromXML(java.io.InputStream)`

    - #### storeToXml

          public void storeToXml(Properties props,
                                 OutputStream os,
                                 String header)
                          throws IOException

      从接口复制的说明: `PropertiesPersister`
      Write the contents of the given Properties object to the given XML OutputStream.
      指定者:
        `storeToXml` 在接口中 `PropertiesPersister`
      参数:
        `props` - the Properties object to store
        `os` - the OutputStream to write to
        `header` - the description of the property list
      抛出:
        `IOException` - in case of I/O errors
      另请参阅:
        `Properties.storeToXML(java.io.OutputStream, String)`

    - #### storeToXml

          public void storeToXml(Properties props,
                                 OutputStream os,
                                 String header,
                                 String encoding)
                          throws IOException

      从接口复制的说明: `PropertiesPersister`
      Write the contents of the given Properties object to the given XML OutputStream.
      指定者:
        `storeToXml` 在接口中 `PropertiesPersister`
      参数:
        `props` - the Properties object to store
        `os` - the OutputStream to write to
        `header` - the description of the property list
        `encoding` - the encoding to use
      抛出:
        `IOException` - in case of I/O errors
      另请参阅:
        `Properties.storeToXML(java.io.OutputStream, String, String)`