public class PropertiesExt extends Object
Constructor and Description |
---|
PropertiesExt() |
PropertiesExt(File file) |
PropertiesExt(InputStream in) |
PropertiesExt(InputStream in,
boolean close) |
PropertiesExt(Map<?,?> map) |
PropertiesExt(String path) |
Modifier and Type | Method and Description |
---|---|
void |
forEach(BiConsumer<Object,Object> action) |
MutableHashSet<Object> |
getKeys()
获取配置文件的所有键
|
Properties |
getProperties() |
String |
getValue(String key)
获取配置文件的值
|
String |
getValue(String key,
String def)
获取配置文件的值
|
MutableHashMap<Object,Object> |
getValues()
获取配置文件的所有值
|
static PropertiesExt |
loadSystem()
加载系统配置项
|
PropertiesExt |
setProperties(Properties properties) |
PropertiesExt |
setValue(String key,
String value)
设置配置文件的值
|
PropertiesExt |
storeSystem()
将当前properties存储到system
|
void |
writeToFile(File file)
properties 转 file
|
void |
writeToXml(File file)
properties 转 xml
|
void |
writeToXml(File file,
String charset)
properties 转 xml
|
public PropertiesExt()
public PropertiesExt(Map<?,?> map)
public PropertiesExt(String path)
public PropertiesExt(File file)
public PropertiesExt(InputStream in)
public PropertiesExt(InputStream in, boolean close)
public static PropertiesExt loadSystem()
delete方法不会删除系统配置, 但是会修改当前properties对象
,
put方法不会修改系统配置, 但是会修改当前properties对象
public String getValue(String key, String def)
key
- keydef
- 默认值public MutableHashMap<Object,Object> getValues()
public MutableHashSet<Object> getKeys()
public PropertiesExt setValue(String key, String value)
key
- keyvalue
- valuepublic Properties getProperties()
public PropertiesExt setProperties(Properties properties)
public void writeToFile(File file) throws IOException
file
- fileIOException
- IOExceptionpublic void writeToXml(File file) throws IOException
file
- xmlIOException
- IOExceptionpublic void writeToXml(File file, String charset) throws IOException
file
- xmlcharset
- 编码格式IOException
- IOExceptionpublic PropertiesExt storeSystem()
public void forEach(BiConsumer<Object,Object> action)
Copyright © 2024. All rights reserved.