本文整理了Java中com.graphhopper.util.Helper.loadProperties()
方法的一些代码示例,展示了Helper.loadProperties()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Helper.loadProperties()
方法的具体详情如下:
包路径:com.graphhopper.util.Helper
类名称:Helper
方法名:loadProperties
暂无
代码示例来源:origin: com.rgi-corp/graphhopper
@Override
public synchronized boolean loadExisting() {
if (!da.loadExisting())
return false;
int len = (int) da.getCapacity();
byte[] bytes = new byte[len];
da.getBytes(0, bytes, len);
try {
Helper.loadProperties(map, new StringReader(new String(bytes, Helper.UTF_CS)));
return true;
} catch (IOException ex) {
throw new IllegalStateException(ex);
}
}
代码示例来源:origin: com.graphhopper/graphhopper
@Override
public boolean loadExisting()
{
if (!da.loadExisting())
return false;
int len = (int) da.getCapacity();
byte[] bytes = new byte[len];
da.getBytes(0, bytes, len);
try
{
Helper.loadProperties(map, new StringReader(new String(bytes, Helper.UTF_CS)));
return true;
} catch (IOException ex)
{
throw new IllegalStateException(ex);
}
}
代码示例来源:origin: com.rgi-corp/graphhopper
/**
* @param fileStr the file name of config.properties
* @param systemProperty the property name of the configuration. E.g. -Dgraphhopper.config
*/
public static CmdArgs readFromConfig(String fileStr, String systemProperty) throws IOException {
if (systemProperty.startsWith("-D"))
systemProperty = systemProperty.substring(2);
String configLocation = System.getProperty(systemProperty);
if (Helper.isEmpty(configLocation))
configLocation = fileStr;
Map<String, String> map = new LinkedHashMap<String, String>();
Helper.loadProperties(map, new InputStreamReader(new FileInputStream(
new File(configLocation).getAbsoluteFile()), Helper.UTF_CS));
CmdArgs args = new CmdArgs();
args.merge(map);
// overwrite with system settings
Properties props = System.getProperties();
for (Entry<Object, Object> e : props.entrySet()) {
String k = ((String) e.getKey());
String v = ((String) e.getValue());
if (k.startsWith("graphhopper.")) {
k = k.substring("graphhopper.".length());
args.put(k, v);
}
}
return args;
}
代码示例来源:origin: com.graphhopper/graphhopper
/**
* @param fileStr the file name of config.properties
* @param systemProperty the property name of the configuration. E.g. -Dgraphhopper.config
*/
public static CmdArgs readFromConfig( String fileStr, String systemProperty ) throws IOException
{
if (systemProperty.startsWith("-D"))
systemProperty = systemProperty.substring(2);
String configLocation = System.getProperty(systemProperty);
if (Helper.isEmpty(configLocation))
configLocation = fileStr;
Map<String, String> map = new LinkedHashMap<String, String>();
Helper.loadProperties(map, new InputStreamReader(new FileInputStream(
new File(configLocation).getAbsoluteFile()), Helper.UTF_CS));
CmdArgs args = new CmdArgs();
args.merge(map);
// overwrite with system settings
Properties props = System.getProperties();
for (Entry<Object, Object> e : props.entrySet())
{
String k = ((String) e.getKey());
String v = ((String) e.getValue());
if (k.startsWith("graphhopper."))
{
k = k.substring("graphhopper.".length());
args.put(k, v);
}
}
return args;
}
内容来源于网络,如有侵权,请联系作者删除!