public class EncodedResource
extends java.lang.Object
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
.
Reader
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
encoding |
private Resource |
resource |
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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() |
private final Resource resource
private final java.lang.String encoding
public EncodedResource(Resource resource)
resource
- the Resource to holdpublic EncodedResource(Resource resource, java.lang.String encoding)
resource
- the Resource to holdencoding
- the encoding to use for reading from the resourcepublic final Resource getResource()
public final java.lang.String getEncoding()
null
if none specified.public java.io.Reader getReader() throws java.io.IOException
java.io.Reader
for the specified resource,
using the specified encoding (if any).java.io.IOException
- if opening the Reader failedpublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object