Package cn.xuanyuanli.core.util
Class PropertiesUtils
java.lang.Object
cn.xuanyuanli.core.util.PropertiesUtils
properties工具
- Author:
- John Li
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classfrom java.util.Properties.LineReader copy -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringkeySaveConvert(String key) 键保存转换private static voidload0(PropertiesUtils.LineReader lr, TreeMap<String, String> treeMap) from java.util.Properties#load0(Properties.LineReader) copyprivate static StringloadConvert(char[] in, int off, int len, char[] convtBuf) from java.util.Properties#loadConvert copyloadTreeMapFromClasspath(String propertiesPath) 加载classpath下的properties文件,返回有序的maploadTreeMapFromFile(String propertiesPath) 加载classpath下的properties文件,返回有序的mapprivate static StringsaveConvert(String theString, boolean escapeSpace, boolean escapeUnicode) 对key和value特殊字符进行转义,参考Properties中的此方法static voidsaveProperties(String descPath, List<String> content, boolean escapeUnicode) 保存内容到相应路径private static chartoHex(int nibble) Convert a nibble to a hex characterstatic StringvalueSaveConvert(String val) 值保存转换
-
Field Details
-
HEX_DIGIT
private static final char[] HEX_DIGITA table of hex digits
-
-
Constructor Details
-
PropertiesUtils
public PropertiesUtils()
-
-
Method Details
-
saveProperties
保存内容到相应路径- Parameters:
descPath- 目标路径content- 内容escapeUnicode- val是否转换为unicode
-
keySaveConvert
键保存转换- Parameters:
key- 键- Returns:
String- See Also:
-
valueSaveConvert
值保存转换- Parameters:
val- 值- Returns:
String- See Also:
-
saveConvert
对key和value特殊字符进行转义,参考Properties中的此方法- Parameters:
theString- 字符串escapeSpace- 逃避空间escapeUnicode- 逃避unicode- Returns:
String
-
toHex
private static char toHex(int nibble) Convert a nibble to a hex character- Parameters:
nibble- the nibble to convert.- Returns:
- char
-
loadConvert
from java.util.Properties#loadConvert copy- Parameters:
in- 在off- 从len- lenconvtBuf- convt缓冲区- Returns:
String
-
loadTreeMapFromClasspath
加载classpath下的properties文件,返回有序的map -
loadTreeMapFromFile
加载classpath下的properties文件,返回有序的map -
load0
private static void load0(PropertiesUtils.LineReader lr, TreeMap<String, String> treeMap) throws IOExceptionfrom java.util.Properties#load0(Properties.LineReader) copy- Parameters:
lr- lrtreeMap- 树map- Throws:
IOException- ioexception
-