本文整理了Java中com.graphhopper.util.Helper.readFile()
方法的一些代码示例,展示了Helper.readFile()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Helper.readFile()
方法的具体详情如下:
包路径:com.graphhopper.util.Helper
类名称:Helper
方法名:readFile
暂无
代码示例来源:origin: graphhopper/graphhopper
public static List<String> readFile(String file) throws IOException {
return readFile(new InputStreamReader(new FileInputStream(file), UTF_CS));
}
代码示例来源:origin: graphhopper/graphhopper
public TranslationHashMap doImport(InputStream is) {
if (is == null)
throw new IllegalStateException("No input stream found in class path!?");
try {
for (String line : readFile(new InputStreamReader(is, UTF_CS))) {
if (line.isEmpty() || line.startsWith("//") || line.startsWith("#"))
continue;
int index = line.indexOf('=');
if (index < 0)
continue;
String key = line.substring(0, index);
if (key.isEmpty())
throw new IllegalStateException("No key provided:" + line);
String value = line.substring(index + 1);
if (!value.isEmpty())
put(key, value);
}
} catch (IOException ex) {
throw new RuntimeException(ex);
}
return this;
}
}
代码示例来源:origin: graphhopper/graphhopper
/**
* The URLs are a bit ugly and so we need to find out which area name a certain lat,lon
* coordinate has.
*/
private SRTMProvider init() {
try {
String strs[] = {"Africa", "Australia", "Eurasia", "Islands", "North_America", "South_America"};
for (String str : strs) {
InputStream is = getClass().getResourceAsStream(str + "_names.txt");
for (String line : Helper.readFile(new InputStreamReader(is, Helper.UTF_CS))) {
int lat = Integer.parseInt(line.substring(1, 3));
if (line.substring(0, 1).charAt(0) == 'S')
lat = -lat;
int lon = Integer.parseInt(line.substring(4, 7));
if (line.substring(3, 4).charAt(0) == 'W')
lon = -lon;
int intKey = calcIntKey(lat, lon);
String key = areas.put(intKey, str);
if (key != null)
throw new IllegalStateException("do not overwrite existing! key " + intKey + " " + key + " vs. " + str);
}
}
return this;
} catch (Exception ex) {
throw new IllegalStateException("Cannot load area names from classpath", ex);
}
}
代码示例来源:origin: graphhopper/graphhopper
List<String> lines = Helper.readFile(file);
List<Integer> landmarkNodeIds = new ArrayList<>();
BBox bbox = BBox.createInverse(false);
代码示例来源:origin: com.graphhopper/graphhopper
public static List<String> readFile( String file ) throws IOException
{
return readFile(new InputStreamReader(new FileInputStream(file), UTF_CS));
}
代码示例来源:origin: com.graphhopper/graphhopper-api
public static List<String> readFile(String file) throws IOException {
return readFile(new InputStreamReader(new FileInputStream(file), UTF_CS));
}
代码示例来源:origin: com.rgi-corp/graphhopper
public static List<String> readFile(String file) throws IOException {
return readFile(new InputStreamReader(new FileInputStream(file), UTF_CS));
}
代码示例来源:origin: com.graphhopper/graphhopper
public TranslationHashMap doImport( InputStream is )
{
if (is == null)
throw new IllegalStateException("No input stream found in class path!?");
try
{
for (String line : Helper.readFile(new InputStreamReader(is, Helper.UTF_CS)))
{
if (line.isEmpty() || line.startsWith("//") || line.startsWith("#"))
continue;
int index = line.indexOf('=');
if (index < 0)
continue;
String key = line.substring(0, index);
if (key.isEmpty())
throw new IllegalStateException("No key provided:" + line);
String value = line.substring(index + 1);
if (!value.isEmpty())
put(key, value);
}
} catch (IOException ex)
{
throw new RuntimeException(ex);
}
return this;
}
}
代码示例来源:origin: com.graphhopper/graphhopper-core
public TranslationHashMap doImport(InputStream is) {
if (is == null)
throw new IllegalStateException("No input stream found in class path!?");
try {
for (String line : readFile(new InputStreamReader(is, UTF_CS))) {
if (line.isEmpty() || line.startsWith("//") || line.startsWith("#"))
continue;
int index = line.indexOf('=');
if (index < 0)
continue;
String key = line.substring(0, index);
if (key.isEmpty())
throw new IllegalStateException("No key provided:" + line);
String value = line.substring(index + 1);
if (!value.isEmpty())
put(key, value);
}
} catch (IOException ex) {
throw new RuntimeException(ex);
}
return this;
}
}
代码示例来源:origin: com.rgi-corp/graphhopper
public TranslationHashMap doImport(InputStream is) {
if (is == null)
throw new IllegalStateException("No input stream found in class path!?");
try {
for (String line : Helper.readFile(new InputStreamReader(is, Helper.UTF_CS))) {
if (line.isEmpty() || line.startsWith("//") || line.startsWith("#"))
continue;
int index = line.indexOf('=');
if (index < 0)
continue;
String key = line.substring(0, index);
if (key.isEmpty())
throw new IllegalStateException("No key provided:" + line);
String value = line.substring(index + 1);
if (!value.isEmpty())
put(key, value);
}
} catch (IOException ex) {
throw new RuntimeException(ex);
}
return this;
}
}
代码示例来源:origin: com.rgi-corp/graphhopper
/**
* The URLs are a bit ugly and so we need to find out which area name a certain lat,lon
* coordinate has.
*/
private SRTMProvider init() {
try {
String strs[] = {"Africa", "Australia", "Eurasia", "Islands", "North_America", "South_America"};
for (String str : strs) {
InputStream is = getClass().getResourceAsStream(str + "_names.txt");
for (String line : Helper.readFile(new InputStreamReader(is, Helper.UTF_CS))) {
int lat = Integer.parseInt(line.substring(1, 3));
if (line.substring(0, 1).charAt(0) == 'S')
lat = -lat;
int lon = Integer.parseInt(line.substring(4, 7));
if (line.substring(3, 4).charAt(0) == 'W')
lon = -lon;
int intKey = calcIntKey(lat, lon);
String key = areas.put(intKey, str);
if (key != null)
throw new IllegalStateException("do not overwrite existing! key " + intKey + " " + key + " vs. " + str);
}
}
return this;
} catch (Exception ex) {
throw new IllegalStateException("Cannot load area names from classpath", ex);
}
}
代码示例来源:origin: com.graphhopper/graphhopper-core
/**
* The URLs are a bit ugly and so we need to find out which area name a certain lat,lon
* coordinate has.
*/
private SRTMProvider init() {
try {
String strs[] = {"Africa", "Australia", "Eurasia", "Islands", "North_America", "South_America"};
for (String str : strs) {
InputStream is = getClass().getResourceAsStream(str + "_names.txt");
for (String line : Helper.readFile(new InputStreamReader(is, Helper.UTF_CS))) {
int lat = Integer.parseInt(line.substring(1, 3));
if (line.substring(0, 1).charAt(0) == 'S')
lat = -lat;
int lon = Integer.parseInt(line.substring(4, 7));
if (line.substring(3, 4).charAt(0) == 'W')
lon = -lon;
int intKey = calcIntKey(lat, lon);
String key = areas.put(intKey, str);
if (key != null)
throw new IllegalStateException("do not overwrite existing! key " + intKey + " " + key + " vs. " + str);
}
}
return this;
} catch (Exception ex) {
throw new IllegalStateException("Cannot load area names from classpath", ex);
}
}
代码示例来源:origin: com.graphhopper/graphhopper
for (String line : Helper.readFile(new InputStreamReader(is, Helper.UTF_CS)))
代码示例来源:origin: com.graphhopper/graphhopper-core
List<String> lines = Helper.readFile(file);
List<Integer> landmarkNodeIds = new ArrayList<>();
BBox bbox = BBox.createInverse(false);
代码示例来源:origin: com.rgi-corp/graphhopper
List<String> lines = Helper.readFile(file);
List<Integer> landmarkNodeIds = new ArrayList<>();
BBox bbox = BBox.createInverse(false);
内容来源于网络,如有侵权,请联系作者删除!