com.graphhopper.util.Helper.loadProperties()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中com.graphhopper.util.Helper.loadProperties()方法的一些代码示例,展示了Helper.loadProperties()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Helper.loadProperties()方法的具体详情如下:
包路径:com.graphhopper.util.Helper
类名称:Helper
方法名:loadProperties

Helper.loadProperties介绍

暂无

代码示例

代码示例来源:origin: com.rgi-corp/graphhopper

  1. @Override
  2. public synchronized boolean loadExisting() {
  3. if (!da.loadExisting())
  4. return false;
  5. int len = (int) da.getCapacity();
  6. byte[] bytes = new byte[len];
  7. da.getBytes(0, bytes, len);
  8. try {
  9. Helper.loadProperties(map, new StringReader(new String(bytes, Helper.UTF_CS)));
  10. return true;
  11. } catch (IOException ex) {
  12. throw new IllegalStateException(ex);
  13. }
  14. }

代码示例来源:origin: com.graphhopper/graphhopper

  1. @Override
  2. public boolean loadExisting()
  3. {
  4. if (!da.loadExisting())
  5. return false;
  6. int len = (int) da.getCapacity();
  7. byte[] bytes = new byte[len];
  8. da.getBytes(0, bytes, len);
  9. try
  10. {
  11. Helper.loadProperties(map, new StringReader(new String(bytes, Helper.UTF_CS)));
  12. return true;
  13. } catch (IOException ex)
  14. {
  15. throw new IllegalStateException(ex);
  16. }
  17. }

代码示例来源:origin: com.rgi-corp/graphhopper

  1. /**
  2. * @param fileStr the file name of config.properties
  3. * @param systemProperty the property name of the configuration. E.g. -Dgraphhopper.config
  4. */
  5. public static CmdArgs readFromConfig(String fileStr, String systemProperty) throws IOException {
  6. if (systemProperty.startsWith("-D"))
  7. systemProperty = systemProperty.substring(2);
  8. String configLocation = System.getProperty(systemProperty);
  9. if (Helper.isEmpty(configLocation))
  10. configLocation = fileStr;
  11. Map<String, String> map = new LinkedHashMap<String, String>();
  12. Helper.loadProperties(map, new InputStreamReader(new FileInputStream(
  13. new File(configLocation).getAbsoluteFile()), Helper.UTF_CS));
  14. CmdArgs args = new CmdArgs();
  15. args.merge(map);
  16. // overwrite with system settings
  17. Properties props = System.getProperties();
  18. for (Entry<Object, Object> e : props.entrySet()) {
  19. String k = ((String) e.getKey());
  20. String v = ((String) e.getValue());
  21. if (k.startsWith("graphhopper.")) {
  22. k = k.substring("graphhopper.".length());
  23. args.put(k, v);
  24. }
  25. }
  26. return args;
  27. }

代码示例来源:origin: com.graphhopper/graphhopper

  1. /**
  2. * @param fileStr the file name of config.properties
  3. * @param systemProperty the property name of the configuration. E.g. -Dgraphhopper.config
  4. */
  5. public static CmdArgs readFromConfig( String fileStr, String systemProperty ) throws IOException
  6. {
  7. if (systemProperty.startsWith("-D"))
  8. systemProperty = systemProperty.substring(2);
  9. String configLocation = System.getProperty(systemProperty);
  10. if (Helper.isEmpty(configLocation))
  11. configLocation = fileStr;
  12. Map<String, String> map = new LinkedHashMap<String, String>();
  13. Helper.loadProperties(map, new InputStreamReader(new FileInputStream(
  14. new File(configLocation).getAbsoluteFile()), Helper.UTF_CS));
  15. CmdArgs args = new CmdArgs();
  16. args.merge(map);
  17. // overwrite with system settings
  18. Properties props = System.getProperties();
  19. for (Entry<Object, Object> e : props.entrySet())
  20. {
  21. String k = ((String) e.getKey());
  22. String v = ((String) e.getValue());
  23. if (k.startsWith("graphhopper."))
  24. {
  25. k = k.substring("graphhopper.".length());
  26. args.put(k, v);
  27. }
  28. }
  29. return args;
  30. }

相关文章