Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.core.io.support
Class EncodedResource

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

    public class EncodedResource

extends java.lang.Object

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

Used as argument for operations that support to read content with a specific encoding (usually through a `java.io.Reader`.

Since:
  1.2.6
Author:
  Juergen Hoeller
See Also:
  `Reader`

Constructor Summary
`EncodedResource(Resource resource)` Create a new EncodedResource for the given Resource, not specifying a specific encoding.
`EncodedResource(Resource resource, java.lang.String encoding)` Create a new EncodedResource for the given Resource, using the specified encoding.

Method Summary
`boolean` | `equals(java.lang.Object obj)`
`java.lang.String` | `getEncoding()` Return the encoding to use for reading from the resource, or `null` if none specified.
`java.io.Reader` | `getReader()` Open a `java.io.Reader` for the specified resource, using the specified encoding (if any).
`Resource` | `getResource()` Return the Resource held.
`int` | `hashCode()`
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### EncodedResource

    public EncodedResource(Resource resource)

  Create a new EncodedResource for the given Resource, not specifying a specific encoding.

  Parameters:
    `resource` - the Resource to hold

### EncodedResource

    public EncodedResource(Resource resource,
                           java.lang.String encoding)

  Create a new EncodedResource for the given Resource, using the specified encoding.

  Parameters:
    `resource` - the Resource to hold
    `encoding` - the encoding to use for reading from the resource

Method Detail

### getResource

    public final Resource getResource()

  Return the Resource held.

### getEncoding

    public final java.lang.String getEncoding()

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

### getReader

    public java.io.Reader getReader()
                             throws java.io.IOException

  Open a `java.io.Reader` for the specified resource, using the specified encoding (if any).

  Throws:
    `java.io.IOException` - if opening the Reader failed

### equals

    public boolean equals(java.lang.Object obj)

  Overrides:
    `equals` in class `java.lang.Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD