sS ipToCountry_dataSnippet = #1008743; static NavigableMap ipToCountry_data = new TreeMap; //synchroNavigableTreeMap(); static Lock ipToCountry_lock = lock(); static S ipToCountry_old(S ip) null on exception { long ipNum = ipToInt(trim(ip)); lock ipToCountry_lock; ipToCountry_init(); Long key = ipToCountry_data.floorKey(ipNum); ret key == null ? null : ipToCountry_data.get(key); } static void ipToCountry_init() { lock ipToCountry_lock; if (nempty(ipToCountry_data)) ret; long start = 0; for (S s : linesFromReader(utf8bufferedReader(gzInputStream(loadLibrary(ipToCountry_dataSnippet))))) { L l = splitAtSpace(s); if (l(l) < 2) continue; long diff = parseLong(first(l)); S country = intern(last(l)); start += diff; ipToCountry_data.put(start, country); } } static void ipToCountry_clearCache() { lock ipToCountry_lock; ipToCountry_data.clear(); }