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| 构造器和说明 |
|---|
EncodedResource(Resource resource)
Create a new
EncodedResource for the given Resource,
not specifying an explicit encoding or Charset. |
EncodedResource(Resource resource,
Charset charset)
Create a new
EncodedResource for the given Resource,
using the specified Charset. |
EncodedResource(Resource resource,
String encoding)
Create a new
EncodedResource for the given Resource,
using the specified encoding. |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
equals(Object other) |
Charset |
getCharset()
|
String |
getEncoding()
Return the encoding to use for reading from the resource,
or
null if none specified. |
InputStream |
getInputStream()
|
Reader |
getReader()
|
Resource |
getResource()
Return the
Resource held by this EncodedResource. |
int |
hashCode() |
boolean |
requiresReader()
Determine whether a
Reader is required as opposed to an InputStream,
i.e. whether an encoding or a Charset
has been specified. |
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, 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.public final String getEncoding()
null if none specified.public final Charset getCharset()
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 在接口中 InputStreamSourcenull)IOException - if opening the InputStream failedrequiresReader(),
getReader()Copyright © 2020. All rights reserved.