properties配置文件中某属性过长需要换行
比如数据库的url如果使用oracle数据库采用tns的时候
如:source.db.url=jdbc:oracle:thin:@(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
查看PropertiesProxy源码发现必须使用冒号并且在最后一行在增加一行注释行才能读取,能否考虑采用properties文件常规换行的方式在行尾添加“\”表示换行呢?
如:source.db.url=jdbc:oracle:thin:@(DESCRIPTION =\
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))\
(CONNECT_DATA =\
(SERVER = DEDICATED)\
(SERVICE_NAME = orcl)\
)\
)
else if (c == ':') {
String name = s.substring(0, pos);
StringBuffer sb = new StringBuffer();
sb.append(s.substring(pos + 1));
String ss;
while (null != (ss = tr.readLine())) {
if (ss.length() > 0 && ss.charAt(0) == '#')
break;
sb.append("\r\n" + ss);
}
maps.put(Strings.trim(name), sb.toString());
if (null == ss)
return;
}