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

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

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

Helper.readFile介绍

暂无

代码示例

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

  1. public static List<String> readFile(String file) throws IOException {
  2. return readFile(new InputStreamReader(new FileInputStream(file), UTF_CS));
  3. }

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

  1. public TranslationHashMap doImport(InputStream is) {
  2. if (is == null)
  3. throw new IllegalStateException("No input stream found in class path!?");
  4. try {
  5. for (String line : readFile(new InputStreamReader(is, UTF_CS))) {
  6. if (line.isEmpty() || line.startsWith("//") || line.startsWith("#"))
  7. continue;
  8. int index = line.indexOf('=');
  9. if (index < 0)
  10. continue;
  11. String key = line.substring(0, index);
  12. if (key.isEmpty())
  13. throw new IllegalStateException("No key provided:" + line);
  14. String value = line.substring(index + 1);
  15. if (!value.isEmpty())
  16. put(key, value);
  17. }
  18. } catch (IOException ex) {
  19. throw new RuntimeException(ex);
  20. }
  21. return this;
  22. }
  23. }

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

  1. /**
  2. * The URLs are a bit ugly and so we need to find out which area name a certain lat,lon
  3. * coordinate has.
  4. */
  5. private SRTMProvider init() {
  6. try {
  7. String strs[] = {"Africa", "Australia", "Eurasia", "Islands", "North_America", "South_America"};
  8. for (String str : strs) {
  9. InputStream is = getClass().getResourceAsStream(str + "_names.txt");
  10. for (String line : Helper.readFile(new InputStreamReader(is, Helper.UTF_CS))) {
  11. int lat = Integer.parseInt(line.substring(1, 3));
  12. if (line.substring(0, 1).charAt(0) == 'S')
  13. lat = -lat;
  14. int lon = Integer.parseInt(line.substring(4, 7));
  15. if (line.substring(3, 4).charAt(0) == 'W')
  16. lon = -lon;
  17. int intKey = calcIntKey(lat, lon);
  18. String key = areas.put(intKey, str);
  19. if (key != null)
  20. throw new IllegalStateException("do not overwrite existing! key " + intKey + " " + key + " vs. " + str);
  21. }
  22. }
  23. return this;
  24. } catch (Exception ex) {
  25. throw new IllegalStateException("Cannot load area names from classpath", ex);
  26. }
  27. }

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

  1. List<String> lines = Helper.readFile(file);
  2. List<Integer> landmarkNodeIds = new ArrayList<>();
  3. BBox bbox = BBox.createInverse(false);

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

  1. public static List<String> readFile( String file ) throws IOException
  2. {
  3. return readFile(new InputStreamReader(new FileInputStream(file), UTF_CS));
  4. }

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

  1. public static List<String> readFile(String file) throws IOException {
  2. return readFile(new InputStreamReader(new FileInputStream(file), UTF_CS));
  3. }

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

  1. public static List<String> readFile(String file) throws IOException {
  2. return readFile(new InputStreamReader(new FileInputStream(file), UTF_CS));
  3. }

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

  1. public TranslationHashMap doImport( InputStream is )
  2. {
  3. if (is == null)
  4. throw new IllegalStateException("No input stream found in class path!?");
  5. try
  6. {
  7. for (String line : Helper.readFile(new InputStreamReader(is, Helper.UTF_CS)))
  8. {
  9. if (line.isEmpty() || line.startsWith("//") || line.startsWith("#"))
  10. continue;
  11. int index = line.indexOf('=');
  12. if (index < 0)
  13. continue;
  14. String key = line.substring(0, index);
  15. if (key.isEmpty())
  16. throw new IllegalStateException("No key provided:" + line);
  17. String value = line.substring(index + 1);
  18. if (!value.isEmpty())
  19. put(key, value);
  20. }
  21. } catch (IOException ex)
  22. {
  23. throw new RuntimeException(ex);
  24. }
  25. return this;
  26. }
  27. }

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

  1. public TranslationHashMap doImport(InputStream is) {
  2. if (is == null)
  3. throw new IllegalStateException("No input stream found in class path!?");
  4. try {
  5. for (String line : readFile(new InputStreamReader(is, UTF_CS))) {
  6. if (line.isEmpty() || line.startsWith("//") || line.startsWith("#"))
  7. continue;
  8. int index = line.indexOf('=');
  9. if (index < 0)
  10. continue;
  11. String key = line.substring(0, index);
  12. if (key.isEmpty())
  13. throw new IllegalStateException("No key provided:" + line);
  14. String value = line.substring(index + 1);
  15. if (!value.isEmpty())
  16. put(key, value);
  17. }
  18. } catch (IOException ex) {
  19. throw new RuntimeException(ex);
  20. }
  21. return this;
  22. }
  23. }

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

  1. public TranslationHashMap doImport(InputStream is) {
  2. if (is == null)
  3. throw new IllegalStateException("No input stream found in class path!?");
  4. try {
  5. for (String line : Helper.readFile(new InputStreamReader(is, Helper.UTF_CS))) {
  6. if (line.isEmpty() || line.startsWith("//") || line.startsWith("#"))
  7. continue;
  8. int index = line.indexOf('=');
  9. if (index < 0)
  10. continue;
  11. String key = line.substring(0, index);
  12. if (key.isEmpty())
  13. throw new IllegalStateException("No key provided:" + line);
  14. String value = line.substring(index + 1);
  15. if (!value.isEmpty())
  16. put(key, value);
  17. }
  18. } catch (IOException ex) {
  19. throw new RuntimeException(ex);
  20. }
  21. return this;
  22. }
  23. }

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

  1. /**
  2. * The URLs are a bit ugly and so we need to find out which area name a certain lat,lon
  3. * coordinate has.
  4. */
  5. private SRTMProvider init() {
  6. try {
  7. String strs[] = {"Africa", "Australia", "Eurasia", "Islands", "North_America", "South_America"};
  8. for (String str : strs) {
  9. InputStream is = getClass().getResourceAsStream(str + "_names.txt");
  10. for (String line : Helper.readFile(new InputStreamReader(is, Helper.UTF_CS))) {
  11. int lat = Integer.parseInt(line.substring(1, 3));
  12. if (line.substring(0, 1).charAt(0) == 'S')
  13. lat = -lat;
  14. int lon = Integer.parseInt(line.substring(4, 7));
  15. if (line.substring(3, 4).charAt(0) == 'W')
  16. lon = -lon;
  17. int intKey = calcIntKey(lat, lon);
  18. String key = areas.put(intKey, str);
  19. if (key != null)
  20. throw new IllegalStateException("do not overwrite existing! key " + intKey + " " + key + " vs. " + str);
  21. }
  22. }
  23. return this;
  24. } catch (Exception ex) {
  25. throw new IllegalStateException("Cannot load area names from classpath", ex);
  26. }
  27. }

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

  1. /**
  2. * The URLs are a bit ugly and so we need to find out which area name a certain lat,lon
  3. * coordinate has.
  4. */
  5. private SRTMProvider init() {
  6. try {
  7. String strs[] = {"Africa", "Australia", "Eurasia", "Islands", "North_America", "South_America"};
  8. for (String str : strs) {
  9. InputStream is = getClass().getResourceAsStream(str + "_names.txt");
  10. for (String line : Helper.readFile(new InputStreamReader(is, Helper.UTF_CS))) {
  11. int lat = Integer.parseInt(line.substring(1, 3));
  12. if (line.substring(0, 1).charAt(0) == 'S')
  13. lat = -lat;
  14. int lon = Integer.parseInt(line.substring(4, 7));
  15. if (line.substring(3, 4).charAt(0) == 'W')
  16. lon = -lon;
  17. int intKey = calcIntKey(lat, lon);
  18. String key = areas.put(intKey, str);
  19. if (key != null)
  20. throw new IllegalStateException("do not overwrite existing! key " + intKey + " " + key + " vs. " + str);
  21. }
  22. }
  23. return this;
  24. } catch (Exception ex) {
  25. throw new IllegalStateException("Cannot load area names from classpath", ex);
  26. }
  27. }

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

  1. for (String line : Helper.readFile(new InputStreamReader(is, Helper.UTF_CS)))

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

  1. List<String> lines = Helper.readFile(file);
  2. List<Integer> landmarkNodeIds = new ArrayList<>();
  3. BBox bbox = BBox.createInverse(false);

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

  1. List<String> lines = Helper.readFile(file);
  2. List<Integer> landmarkNodeIds = new ArrayList<>();
  3. BBox bbox = BBox.createInverse(false);

相关文章