public class EncodedResource extends Object implements InputStreamSource
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.
InputStreamSource.getInputStream(), 
Reader, 
Charset| Constructor and Description | 
|---|
| EncodedResource(Resource resource)Create a new  EncodedResourcefor the givenResource,
 not specifying an explicit encoding orCharset. | 
| EncodedResource(Resource resource,
               Charset charset)Create a new  EncodedResourcefor the givenResource,
 using the specifiedCharset. | 
| EncodedResource(Resource resource,
               String encoding)Create a new  EncodedResourcefor the givenResource,
 using the specifiedencoding. | 
| Modifier and Type | Method and Description | 
|---|---|
| boolean | equals(Object other) | 
| Charset | getCharset() | 
| String | getEncoding()Return the encoding to use for reading from the resource,
 or  nullif none specified. | 
| InputStream | getInputStream() | 
| Reader | getReader() | 
| Resource | getResource()Return the  Resourceheld by thisEncodedResource. | 
| int | hashCode() | 
| boolean | requiresReader()Determine whether a  Readeris required as opposed to anInputStream,
 i.e. | 
| String | toString() | 
public EncodedResource(Resource resource)
EncodedResource for the given Resource,
 not specifying an explicit encoding or Charset.resource - the Resource to hold (never null)public EncodedResource(Resource resource, @Nullable String encoding)
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 resourcepublic final Resource getResource()
Resource held by this EncodedResource.@Nullable public final String getEncoding()
null if none specified.public boolean requiresReader()
Reader is required as opposed to an InputStream,
 i.e. whether an encoding or a Charset
 has been specified.getReader(), 
getInputStream()public Reader getReader() throws IOException
IOException - if opening the Reader failedrequiresReader(), 
getInputStream()public InputStream getInputStream() throws IOException
getInputStream in interface InputStreamSourcenull)IOException - if opening the InputStream failedrequiresReader(), 
getReader()