public abstract class ReaderPropertiesLoader extends AbstractPropertiesLoader
Properties 配置文件加载器
这个相比 cn.com.fishin.tuz.loader.properties.InputStreamPropertiesLoader 多了一个字符集属性,可以避免非英文字符出现乱码问题,默认使用 UTF8 字符集
这个加载器适用于使用 Reader 加载资源文件的加载器, 子类必须实现 getReader(String resourceFileName) 方法
Properties file loader
This loader uses Reader to load resource, subclass must implement method getReader(String resourceFileName)
Email: fishinlove@163.com
created by 2019/03/29 23:55:59
InputStreamPropertiesLoader| 限定符 | 构造器和说明 |
|---|---|
protected |
ReaderPropertiesLoader(java.lang.String resourceFileName,
java.lang.String namespace,
java.nio.charset.Charset charset)
根据资源文件名称构建
Construct with resource file
|
| 限定符和类型 | 方法和说明 |
|---|---|
protected abstract java.io.Reader |
getReader(java.lang.String resourceFileName,
java.nio.charset.Charset charset)
获得输入端
Get reader
|
protected java.util.Properties |
loadProperties()
这个方法留给子类实现
这里不管子类从哪里获取 Properties,只要保证能获得就行了
This method is abstract, its subclass should implement
|
java.lang.String |
namespace()
获取这个加载资源的命名空间
Get the namespace
|
loadprotected ReaderPropertiesLoader(java.lang.String resourceFileName,
java.lang.String namespace,
java.nio.charset.Charset charset)
根据资源文件名称构建
Construct with resource file
resourceFileName - 资源文件名称
resource file
namespace - 指定的命名空间
Appointed namespace
charset - 读取资源的字符集
The charset of this resource
public java.lang.String namespace()
Loadable获取这个加载资源的命名空间
Get the namespace
这个资源的命名空间
The namespace of this resource
protected java.util.Properties loadProperties()
throws java.io.IOException
AbstractPropertiesLoader这个方法留给子类实现
这里不管子类从哪里获取 Properties,只要保证能获得就行了
This method is abstract, its subclass should implement
loadProperties 在类中 AbstractPropertiesLoader返回一个 Properties 对象
Return a Properties instance
java.io.IOException - 如果加载过程出错,比如文件找不到,流创建失败等都有可能导致这个异常
If loading has error or file not found, even inputStream created failed causes this exception
protected abstract java.io.Reader getReader(java.lang.String resourceFileName,
java.nio.charset.Charset charset)
throws java.io.IOException
获得输入端
Get reader
resourceFileName - 资源文件名
resource file name
charset - 字符集
Charset
文件输入端
file reader
java.io.IOException - 输入端创建错误就会抛出这个异常
If the reader created failed
Copyright © 2019. All Rights Reserved.