The Spring Framework

org.springframework.core.io.support
Class EncodedResource

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

public class EncodedResource
extends 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, String encoding)
          Create a new EncodedResource for the given Resource, using the specified encoding.
 
Method Summary
 String getEncoding()
          Return the encoding to use for reading from the resource, or null if none specified.
 Reader getReader()
          Open a java.io.Reader for the specified resource, using the specified encoding (if any).
 Resource getResource()
          Return the Resource held.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, 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,
                       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 String getEncoding()
Return the encoding to use for reading from the resource, or null if none specified.


getReader

public Reader getReader()
                 throws IOException
Open a java.io.Reader for the specified resource, using the specified encoding (if any).

Throws:
IOException - if opening the Reader failed

The Spring Framework

Copyright © 2002-2007 The Spring Framework.