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
 boolean equals(Object obj)
           
 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.
 int hashCode()
           
 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,
                       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

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2002-2008 The Spring Framework.