public static List<String> readFile(String file) throws IOException { return readFile(new InputStreamReader(new FileInputStream(file), UTF_CS)); }
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; } }
/** * 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); } }
List<String> lines = Helper.readFile(file); List<Integer> landmarkNodeIds = new ArrayList<>(); BBox bbox = BBox.createInverse(false);
public static List<String> readFile( String file ) throws IOException { return readFile(new InputStreamReader(new FileInputStream(file), UTF_CS)); }
public static List<String> readFile(String file) throws IOException { return readFile(new InputStreamReader(new FileInputStream(file), UTF_CS)); }
public static List<String> readFile(String file) throws IOException { return readFile(new InputStreamReader(new FileInputStream(file), UTF_CS)); }
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; } }
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; } }
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; } }
/** * 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); } }
/** * 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); } }
for (String line : Helper.readFile(new InputStreamReader(is, Helper.UTF_CS)))
List<String> lines = Helper.readFile(file); List<Integer> landmarkNodeIds = new ArrayList<>(); BBox bbox = BBox.createInverse(false);
List<String> lines = Helper.readFile(file); List<Integer> landmarkNodeIds = new ArrayList<>(); BBox bbox = BBox.createInverse(false);