Package org.aoju.bus.setting
Class Readers
java.lang.Object
org.aoju.bus.setting.Readers
Setting文件加载器
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected IniSettingdefaultFormat(Reader reader) format reader to ini beanprotected IniSettingdefaultFormat(Reader reader, int builderCapacity) format reader to ini beanprotected Formatget a default formatter by factorybooleanload(InputStream inputStream) 加载设置文件 此方法不会关闭流对象booleanload(org.aoju.bus.core.io.resource.Resource resource) 加载设置文件read ini file to beanread(InputStream in) read ini data from an inputStreamto buffered and readread ini file to beanvoidsetCommentElementFormatterSupplier(Supplier<ElementFormatter<IniComment>> commentElementFormatterSupplier) voidsetPropertyElementFormatterSupplier(Supplier<ElementFormatter<IniProperty>> propertyElementFormatterSupplier) voidsetSectionElementFormatterSupplier(Supplier<ElementFormatter<IniSection>> sectionElementFormatterSupplier) voidsetVarRegex(String regex) 设置变量的正则 正则只能有一个group表示变量本身,剩余为字符 例如 \$\{(name)\}表示${name}变量名为name的一个变量表示void持久化当前设置,会覆盖掉之前的设置 持久化会不会保留之前的分组void持久化当前设置,会覆盖掉之前的设置 持久化会不会保留之前的分组
-
Constructor Details
-
Readers
public Readers() -
Readers
-
Readers
构造- Parameters:
groupMap- GroupedMap
-
Readers
构造- Parameters:
groupMap- GroupedMapcharset- 编码isUseVariable- 是否使用变量
-
-
Method Details
-
load
public boolean load(org.aoju.bus.core.io.resource.Resource resource) 加载设置文件- Parameters:
resource- 配置文件URL- Returns:
- 加载是否成功
-
load
加载设置文件 此方法不会关闭流对象- Parameters:
inputStream- 文件流- Returns:
- 加载成功与否
- Throws:
IOException- IO异常
-
setVarRegex
设置变量的正则 正则只能有一个group表示变量本身,剩余为字符 例如 \$\{(name)\}表示${name}变量名为name的一个变量表示- Parameters:
regex- 正则
-
store
持久化当前设置,会覆盖掉之前的设置 持久化会不会保留之前的分组- Parameters:
absolutePath- 设置文件的绝对路径
-
store
持久化当前设置,会覆盖掉之前的设置 持久化会不会保留之前的分组- Parameters:
file- 设置文件
-
getFormatter
get a default formatter by factory- Returns:
Format
-
read
read ini data from an inputStream- Parameters:
in- an ini data inputStream- Returns:
- ini bean
- Throws:
IOException- io exception- See Also:
-
read
read ini file to bean- Parameters:
file- ini file- Returns:
- ini bean
- Throws:
IOException- io exception- See Also:
-
read
read ini file to bean- Parameters:
path- ini path(file)- Returns:
- ini bean
- Throws:
IOException- io exception- See Also:
-
read
to buffered and read- Parameters:
reader- ini data reader- Returns:
- the object
- Throws:
IOException- io exception
-
defaultFormat
format reader to ini bean- Parameters:
reader- reader- Returns:
IniSettingbean- Throws:
IOException- io exception- See Also:
-
defaultFormat
format reader to ini bean- Parameters:
reader- readerbuilderCapacity-StringBuilderinit param- Returns:
IniSettingbean- Throws:
IOException- io exception
-
getCommentElementFormatterSupplier
-
setCommentElementFormatterSupplier
public void setCommentElementFormatterSupplier(Supplier<ElementFormatter<IniComment>> commentElementFormatterSupplier) -
getSectionElementFormatterSupplier
-
setSectionElementFormatterSupplier
public void setSectionElementFormatterSupplier(Supplier<ElementFormatter<IniSection>> sectionElementFormatterSupplier) -
getPropertyElementFormatterSupplier
-
setPropertyElementFormatterSupplier
public void setPropertyElementFormatterSupplier(Supplier<ElementFormatter<IniProperty>> propertyElementFormatterSupplier)
-