org.springframework.core.io.support

## 类 EncodedResource

- java.lang.Object
- - org.springframework.core.io.support.EncodedResource

- 所有已实现的接口:
    InputStreamSource

      public class EncodedResource
      extends Object
      implements InputStreamSource

  Holder that combines a `Resource` descriptor with a specific encoding or `Charset` to be used for reading from the resource.

  Used as an argument for operations that support reading content with a specific encoding, typically via a `java.io.Reader`.

  从以下版本开始:
    1.2.6
  作者:
    Juergen Hoeller, Sam Brannen
  另请参阅:
    `InputStreamSource.getInputStream()`, `Reader`, `Charset`

- - ### 构造器概要

    构造器
    构造器和说明
    `EncodedResource(Resource resource)` Create a new `EncodedResource` for the given `Resource`, not specifying an explicit encoding or `Charset`.
    `EncodedResource(Resource resource, Charset charset)` Create a new `EncodedResource` for the given `Resource`, using the specified `Charset`.
    `EncodedResource(Resource resource, String encoding)` Create a new `EncodedResource` for the given `Resource`, using the specified `encoding`.

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `boolean` | `equals(Object other)`
    `Charset` | `getCharset()` Return the `Charset` to use for reading from the resource, or `null` if none specified.
    `String` | `getEncoding()` Return the encoding to use for reading from the resource, or `null` if none specified.
    `InputStream` | `getInputStream()` Open an `InputStream` for the specified resource, ignoring any specified `Charset` or encoding.
    `Reader` | `getReader()` Open a `java.io.Reader` for the specified resource, using the specified `Charset` or encoding (if any).
    `Resource` | `getResource()` Return the `Resource` held by this `EncodedResource`.
    `int` | `hashCode()`
    `boolean` | `requiresReader()` Determine whether a `Reader` is required as opposed to an `InputStream`, i.e. whether an encoding or a `Charset` has been specified.
    `String` | `toString()`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

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

    - #### EncodedResource

          public EncodedResource(Resource resource)

      Create a new `EncodedResource` for the given `Resource`, not specifying an explicit encoding or `Charset`.
      参数:
        `resource` - the `Resource` to hold (never `null`)

    - #### EncodedResource

          public EncodedResource(Resource resource,
                                 @Nullable
                                 String encoding)

      Create a new `EncodedResource` for the given `Resource`, using the specified `encoding`.
      参数:
        `resource` - the `Resource` to hold (never `null`)
        `encoding` - the encoding to use for reading from the resource

    - #### EncodedResource

          public EncodedResource(Resource resource,
                                 @Nullable
                                 Charset charset)

      Create a new `EncodedResource` for the given `Resource`, using the specified `Charset`.
      参数:
        `resource` - the `Resource` to hold (never `null`)
        `charset` - the `Charset` to use for reading from the resource

  - ### 方法详细资料

    - #### getResource

          public final Resource getResource()

      Return the `Resource` held by this `EncodedResource`.

    - #### getEncoding

          @Nullable
          public final String getEncoding()

      Return the encoding to use for reading from the resource, or `null` if none specified.

    - #### getCharset

          @Nullable
          public final Charset getCharset()

      Return the `Charset` to use for reading from the resource, or `null` if none specified.

    - #### requiresReader

          public boolean requiresReader()

      Determine whether a `Reader` is required as opposed to an `InputStream`, i.e. whether an encoding or a `Charset` has been specified.
      另请参阅:
        `getReader()`, `getInputStream()`

    - #### getReader

          public Reader getReader()
                           throws IOException

      Open a `java.io.Reader` for the specified resource, using the specified `Charset` or encoding (if any).
      抛出:
        `IOException` - if opening the Reader failed
      另请参阅:
        `requiresReader()`, `getInputStream()`

    - #### getInputStream

          public InputStream getInputStream()
                                     throws IOException

      Open an `InputStream` for the specified resource, ignoring any specified `Charset` or encoding.
      指定者:
        `getInputStream` 在接口中 `InputStreamSource`
      返回:
        the input stream for the underlying resource (must not be `null`)
      抛出:
        `IOException` - if opening the InputStream failed
      另请参阅:
        `requiresReader()`, `getReader()`

    - #### equals

          public boolean equals(Object other)

      覆盖:
        `equals` 在类中 `Object`

    - #### hashCode

          public int hashCode()

      覆盖:
        `hashCode` 在类中 `Object`

    - #### toString

          public String toString()

      覆盖:
        `toString` 在类中 `Object`